mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 19:10:11 +01:00
make sure file-streams of subprocesses get closed
This commit is contained in:
parent
be874b1134
commit
a718c75b05
@ -1789,6 +1789,12 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou
|
|||||||
result.returncode = p.wait()
|
result.returncode = p.wait()
|
||||||
result.output = buf.getvalue()
|
result.output = buf.getvalue()
|
||||||
buf.close()
|
buf.close()
|
||||||
|
# make sure all filestreams of the subprocess are closed
|
||||||
|
for streamvar in ['stdin', 'stdout', 'stderr']:
|
||||||
|
if hasattr(p, streamvar):
|
||||||
|
stream = getattr(p, streamvar)
|
||||||
|
if stream:
|
||||||
|
stream.close()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user