Pkg.getstatusoutput: Close process stdout as soon as we're done with it
This commit is contained in:
parent
f427637004
commit
e8dc19461b
5
Pkg.py
5
Pkg.py
|
@ -113,12 +113,13 @@ def getstatusoutput(cmd, stdoutonly=False, shell=False, raw=False):
|
|||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, close_fds=True)
|
||||
proc.stdin.close()
|
||||
text = proc.stdout.read()
|
||||
with proc.stdout:
|
||||
text = proc.stdout.read()
|
||||
sts = proc.wait()
|
||||
if not raw:
|
||||
text = b2s(text)
|
||||
if text.endswith('\n'):
|
||||
text = text[:-1]
|
||||
sts = proc.wait()
|
||||
if sts is None:
|
||||
sts = 0
|
||||
return sts, text
|
||||
|
|
Loading…
Reference in New Issue