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
diff --git a/repo b/repo
index c1d8619..13ccd2b 100755
--- a/repo
+++ b/repo
@@ -120,6 +120,7 @@
import errno
import optparse
+import platform
import re
import shutil
import stat
@@ -887,7 +888,10 @@
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)