Skip to content

Commit 0e1068d

Browse files
authored
Merge pull request #6789 from erg/fix-swift-3.1-branch-update-checkout
utils: If shell.run_parallel is not called before run.shell(), then the lock is not yet initialized
2 parents badaeb2 + 081e962 commit 0e1068d

File tree

1 file changed

+7
-2
lines changed
  • utils/swift_build_support/swift_build_support

1 file changed

+7
-2
lines changed

utils/swift_build_support/swift_build_support/shell.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ def copytree(src, dest, dry_run=None, echo=True):
175175
shutil.copytree(src, dest)
176176

177177

178+
# Initialized later
179+
lock = None
180+
178181
def run(*args, **kwargs):
179182
repo_path = os.getcwd()
180183
echo_output = kwargs.pop('echo', False)
@@ -189,7 +192,8 @@ def run(*args, **kwargs):
189192
(stdout, stderr) = my_pipe.communicate()
190193
ret = my_pipe.wait()
191194

192-
lock.acquire()
195+
if lock:
196+
lock.acquire()
193197
if echo_output:
194198
print(repo_path)
195199
_echo_command(dry_run, *args, env=env)
@@ -198,7 +202,8 @@ def run(*args, **kwargs):
198202
if stderr:
199203
print(stderr, end="")
200204
print()
201-
lock.release()
205+
if lock:
206+
lock.release()
202207

203208
if ret != 0:
204209
eout = Exception()

0 commit comments

Comments
 (0)