From 35d22217a5ed2f8b5b9b183217923071ccfe7f37 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Tue, 1 Nov 2016 11:24:52 -0700 Subject: [PATCH] Ensure repo waits for child process to terminate See http://stackoverflow.com/questions/7004687/os-exec-on-windows: execv on Windows does not behave as on Linux, i.e. a new process is spawned and the parent process terminates right away, which makes the shell prompt come back too soon. Change-Id: I1f8d23208765988629f081e9b949c67cf71c08ae --- repo | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/repo b/repo index c1d86194..13ccd2ba 100755 --- a/repo +++ b/repo @@ -120,6 +120,7 @@ GITC_FS_ROOT_DIR = '/gitc/manifest-rw/' import errno import optparse +import platform import re import shutil import stat @@ -887,7 +888,10 @@ def main(orig_args): me.extend(orig_args) me.extend(extra_args) try: - os.execv(sys.executable, me) + if platform.system() == "Windows": + sys.exit(subprocess.call(me)) + else: + os.execv(sys.executable, me) except OSError as e: _print("fatal: unable to start %s" % repo_main, file=sys.stderr) _print("fatal: %s" % e, file=sys.stderr)