Refactoring stuff

This commit is contained in:
2021-12-04 18:23:00 -06:00
parent 8c69cdebe5
commit cbf5706845
7 changed files with 86 additions and 77 deletions

View File

@@ -35,9 +35,16 @@ class Launcher:
else:
command = ["xdg-open", file]
self.execute(command)
def execute(self, command, start_dir=os.getenv("HOME"), use_os_system=None):
self.logger.debug(command)
DEVNULL = open(os.devnull, 'w')
subprocess.Popen(command, start_new_session=True, stdout=DEVNULL, stderr=DEVNULL, close_fds=True)
if use_os_system:
os.system(command)
else:
DEVNULL = open(os.devnull, 'w')
subprocess.Popen(command, cwd=start_dir, shell=False, start_new_session=True, stdout=DEVNULL, stderr=DEVNULL, close_fds=True)
def remux_video(self, hash, file):