From 38d484543abf3b3ae1ebcab0ad0f90c0673ed323 Mon Sep 17 00:00:00 2001 From: brandjon Date: Thu, 23 May 2019 07:11:53 -0700 Subject: [PATCH] Use `sys.exit()` instead of `exit()` in stub script `exit()` doesn't exist if python was invoked without the `site` module. See https://github.com/bazelbuild/bazel/issues/7947#issuecomment-494990224 (#7947). RELNOTES: None PiperOrigin-RevId: 249636384 --- .../build/lib/bazel/rules/python/python_stub_template.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt index 3e6dccdcf1a57c..2b22666af0c654 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/python_stub_template.txt @@ -279,7 +279,7 @@ def Main(): ret_code = subprocess.call(args) shutil.rmtree(os.path.dirname(module_space), True) MaybeEmitHostVersionWarning(ret_code) - exit(ret_code) + sys.exit(ret_code) else: # On Windows, os.execv doesn't handle arguments with spaces correctly, # and it actually starts a subprocess just like subprocess.call. @@ -288,7 +288,7 @@ def Main(): if IsWindows() or %enable_host_version_warning%: ret_code = subprocess.call(args) MaybeEmitHostVersionWarning(ret_code) - exit(ret_code) + sys.exit(ret_code) else: os.execv(args[0], args) except EnvironmentError: