mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 07:22:29 +03:00
Merge branch 'close-subprocess-file-handles' into 'master'
make sure file-streams of subprocesses get closed See merge request !328
This commit is contained in:
commit
3aee9b3f11
1 changed files with 6 additions and 0 deletions
|
@ -1804,6 +1804,12 @@ def FDroidPopenBytes(commands, cwd=None, envs=None, output=True, stderr_to_stdou
|
|||
result.returncode = p.wait()
|
||||
result.output = buf.getvalue()
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue