summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenaud Paquay <rpaquay@google.com>2016-11-01 11:24:52 -0700
committerDavid Pursehouse <dpursehouse@collab.net>2017-05-29 13:56:18 +0900
commit35d22217a5ed2f8b5b9b183217923071ccfe7f37 (patch)
treec964046a80b06fa502887e653c3ccd8482966332
parenta24671f661f1fae6678e2bcdd3c9fbae0ad7100f (diff)
downloadgit-repo-35d22217a5ed2f8b5b9b183217923071ccfe7f37.tar.gz
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
-rwxr-xr-xrepo6
1 files changed, 5 insertions, 1 deletions
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/'
120 120
121import errno 121import errno
122import optparse 122import optparse
123import platform
123import re 124import re
124import shutil 125import shutil
125import stat 126import stat
@@ -887,7 +888,10 @@ def main(orig_args):
887 me.extend(orig_args) 888 me.extend(orig_args)
888 me.extend(extra_args) 889 me.extend(extra_args)
889 try: 890 try:
890 os.execv(sys.executable, me) 891 if platform.system() == "Windows":
892 sys.exit(subprocess.call(me))
893 else:
894 os.execv(sys.executable, me)
891 except OSError as e: 895 except OSError as e:
892 _print("fatal: unable to start %s" % repo_main, file=sys.stderr) 896 _print("fatal: unable to start %s" % repo_main, file=sys.stderr)
893 _print("fatal: %s" % e, file=sys.stderr) 897 _print("fatal: %s" % e, file=sys.stderr)