diff options
author | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2017-12-22 13:21:11 +0000 |
---|---|---|
committer | Angelos Evripiotis <jevripiotis@bloomberg.net> | 2017-12-22 13:24:07 +0000 |
commit | eae6d5c70781a7be3dd4cfa57be66a1a37311af0 (patch) | |
tree | 58f4454efda7afb355b30478f92e38d698882890 /buildstream | |
parent | dda1ebe4f588640fd435b2526bcb7e1712b4b7dc (diff) | |
download | buildstream-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 $!
Diffstat (limited to 'buildstream')
-rw-r--r-- | buildstream/utils.py | 2 |
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: |