From f1ddaaa553521c5c659271dd52c8d33866a51936 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Fri, 4 Aug 2023 21:13:38 +0000 Subject: [PATCH] main: Pass path to python binary as arg0 when restarting repo Not including it causes flaky behavior in some Chromium builders because Chromium's custom Python build used by vpython relies on argv[0] to find its own internal files. Bug: https://crbug.com/1468522 Change-Id: I5c32ebe71c9b684d6ee50dbd8c3d6fcd51ca309b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381974 Reviewed-by: Chenlin Fan Reviewed-by: Mike Frysinger Commit-Queue: Gavin Mak Tested-by: Gavin Mak --- main.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/main.py b/main.py index 57a59acb..b213f0a4 100755 --- a/main.py +++ b/main.py @@ -887,11 +887,10 @@ def _Main(argv): result = KEYBOARD_INTERRUPT_EXIT except RepoChangedException as rce: # If repo changed, re-exec ourselves. - # argv = list(sys.argv) argv.extend(rce.extra_args) try: - os.execv(sys.executable, [__file__] + argv) + os.execv(sys.executable, [sys.executable, __file__] + argv) except OSError as e: print("fatal: cannot restart repo after upgrade", file=sys.stderr) print("fatal: %s" % e, file=sys.stderr)