diff options
author | Renaud Paquay <rpaquay@google.com> | 2016-11-01 11:24:52 -0700 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2017-05-29 13:56:18 +0900 |
commit | 35d22217a5ed2f8b5b9b183217923071ccfe7f37 (patch) | |
tree | c964046a80b06fa502887e653c3ccd8482966332 | |
parent | a24671f661f1fae6678e2bcdd3c9fbae0ad7100f (diff) | |
download | git-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-x | repo | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -120,6 +120,7 @@ GITC_FS_ROOT_DIR = '/gitc/manifest-rw/' | |||
120 | 120 | ||
121 | import errno | 121 | import errno |
122 | import optparse | 122 | import optparse |
123 | import platform | ||
123 | import re | 124 | import re |
124 | import shutil | 125 | import shutil |
125 | import stat | 126 | import 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) |