From b9aabb85456b65fa2a3b5d98a8299216021cde91 Mon Sep 17 00:00:00 2001 From: Marcus Yanello <94466282+MYanello@users.noreply.github.com> Date: Mon, 13 Jun 2022 21:04:40 -0500 Subject: [PATCH] Redirect stdout from custom command to the log files (#1008) Send the logs for the custom command subprocess to the logs Closes #1007 --- core/app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/app.py b/core/app.py index 656b5413..0d30680b 100644 --- a/core/app.py +++ b/core/app.py @@ -555,9 +555,13 @@ class DupeGuru(Broadcaster): # a workaround to make the damn thing work. exepath, args = match.groups() path, exename = op.split(exepath) - subprocess.Popen(exename + args, shell=True, cwd=path) + p = subprocess.Popen(exename + args, shell=True, cwd=path, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output = p.stdout.read() + logging.info("Custom command %s %s: %s", exename, args, output) else: - subprocess.Popen(dupe_cmd, shell=True) + p = subprocess.Popen(dupe_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + output = p.stdout.read() + logging.info("Custom command %s: %s", dupe_cmd, output) def load(self): """Load directory selection and ignore list from files in appdata.