From eaa05c34babf0e5bc7d87b229aa4dfd746134794 Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Thu, 4 Jun 2020 21:14:11 -0700 Subject: [PATCH] avoid piping subprocess command output when not waiting for results --- daemon/core/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/core/utils.py b/daemon/core/utils.py index 8a988ede..c16d18b5 100644 --- a/daemon/core/utils.py +++ b/daemon/core/utils.py @@ -228,7 +228,8 @@ def cmd( if shell is False: args = shlex.split(args) try: - p = Popen(args, stdout=PIPE, stderr=PIPE, env=env, cwd=cwd, shell=shell) + output = PIPE if wait else DEVNULL + p = Popen(args, stdout=output, stderr=output, env=env, cwd=cwd, shell=shell) if wait: stdout, stderr = p.communicate() stdout = stdout.decode("utf-8").strip()