From dd37fb22227f2abfb4b4f657dded42d422ac2e9c Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 16 Apr 2020 12:38:04 -0400 Subject: [PATCH] main: re-exec self with the current interp The launcher already raised itself up to use Python 3 on the fly, and the main.py script uses a plain `python` shebang. So make sure we use the active interpreter when re-execing ourselves to avoid falling back down to Python 2 (which then triggers warnings). Change-Id: Ic53c07dead3bc9233e4089a0a422f83bb5ac2f91 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/263272 Tested-by: Mike Frysinger Reviewed-by: David Pursehouse --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 1393b400..1d73fce3 100755 --- a/main.py +++ b/main.py @@ -614,7 +614,7 @@ def _Main(argv): argv = list(sys.argv) argv.extend(rce.extra_args) try: - os.execv(__file__, argv) + os.execv(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)