From a718c75b05e33ed5c6418a20bde5cbfc23be8c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Thu, 7 Sep 2017 02:36:58 +0200 Subject: [PATCH] make sure file-streams of subprocesses get closed --- fdroidserver/common.py | 6 ++++++ 1 file changed, 6 insertions(+) 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