avoid piping subprocess command output when not waiting for results
This commit is contained in:
parent
7b2dd59c81
commit
eaa05c34ba
1 changed files with 2 additions and 1 deletions
|
@ -228,7 +228,8 @@ def cmd(
|
||||||
if shell is False:
|
if shell is False:
|
||||||
args = shlex.split(args)
|
args = shlex.split(args)
|
||||||
try:
|
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:
|
if wait:
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
stdout = stdout.decode("utf-8").strip()
|
stdout = stdout.decode("utf-8").strip()
|
||||||
|
|
Loading…
Reference in a new issue