summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2017-12-22 13:21:11 +0000
committerAngelos Evripiotis <jevripiotis@bloomberg.net>2017-12-22 13:24:07 +0000
commiteae6d5c70781a7be3dd4cfa57be66a1a37311af0 (patch)
tree58f4454efda7afb355b30478f92e38d698882890
parentdda1ebe4f588640fd435b2526bcb7e1712b4b7dc (diff)
downloadbuildstream-eae6d5c70781a7be3dd4cfa57be66a1a37311af0.tar.gz
utils._call: fix race condition on 'process' var
Tested by inflating the chance of hitting the race. First, insert a sleep between opening the terminator context and starting the process, then: python3 -c 'import buildstream.utils; import os; \ buildstream.utils._call(["echo", "hello"], True); \ print(os.getpid())' & sleep 1; kill $!
-rw-r--r--buildstream/utils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/buildstream/utils.py b/buildstream/utils.py
index 581cce9be..a96a1a234 100644
--- a/buildstream/utils.py
+++ b/buildstream/utils.py
@@ -819,6 +819,8 @@ def _call(*popenargs, terminate=False, **kwargs):
kwargs['start_new_session'] = True
+ process = None
+
# Handle termination, suspend and resume
def kill_proc():
if process: