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
This commit is contained in:
Renaud Paquay 2016-11-01 11:24:52 -07:00 committed by David Pursehouse
parent a24671f661
commit 35d22217a5

6
repo
View File

@ -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)