From: Michael Pöhn Date: Thu, 7 Sep 2017 00:36:58 +0000 (+0200) Subject: make sure file-streams of subprocesses get closed X-Git-Tag: 0.9~89^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a718c75b05e33ed5c6418a20bde5cbfc23be8c40;p=fdroidserver.git make sure file-streams of subprocesses get closed --- diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 95b1b06c..43471bfc 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -1789,6 +1789,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