commit | 9494301518f2d201cd8d478b9a8ed99a9b3ee955 | [log] [tgz] |
---|---|---|
author | brandjon <brandjon@google.com> | Thu May 23 07:11:53 2019 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Thu May 23 07:13:05 2019 -0700 |
tree | 4f43e6a206e58dd6366b3855e21f32b867eb29fb | |
parent | 39f31abb7c923bc9b7e24a19edf69427cbe7e8b5 [diff] |
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
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 3e6dccd..2b22666 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 @@ 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 @@ 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: