aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-01-05 16:24:24 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-05 18:11:37 +0000
commitff6f53bd00d0bc00232fe439b5ae0d94f53eee1a (patch)
tree79a30ef1f3872ef4cc1fcfd964fcac2abfedee87
parent0258f4d277edbaf9e790fca9b79085a41e18c036 (diff)
build_scripts: Ensure cmake process terminates
Use a context manager to fix warning: c:\Python310\lib\subprocess.py:1067: ResourceWarning: subprocess 7844 is still running _warn("subprocess %s is still running" % self.pid, ResourceWarning: Enable tracemalloc to get the object allocation traceback Change-Id: I6e3ebf584974f8a2d3776847b13fe092d3d4be4a Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 5925ccb54b818e9dfc0766480683d232f95e6965) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--build_scripts/utils.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/build_scripts/utils.py b/build_scripts/utils.py
index 1aacf42d1..79ba2f5ac 100644
--- a/build_scripts/utils.py
+++ b/build_scripts/utils.py
@@ -405,13 +405,12 @@ def rmtree(dirname, ignore=False):
def run_process_output(args, initial_env=None):
if initial_env is None:
initial_env = os.environ
- std_out = subprocess.Popen(args, env=initial_env, universal_newlines=1,
- stdout=subprocess.PIPE).stdout
result = []
- for raw_line in std_out.readlines():
- line = raw_line
- result.append(line.rstrip())
- std_out.close()
+ with subprocess.Popen(args, env=initial_env, universal_newlines=1,
+ stdout=subprocess.PIPE) as p:
+ for raw_line in p.stdout.readlines():
+ result.append(raw_line.rstrip())
+ p.stdout.close()
return result