diff options
author | Philipp Schrader <philipp@peloton-tech.com> | 2016-07-20 10:34:27 +0000 |
---|---|---|
committer | John Cater <jcater@google.com> | 2016-07-20 15:01:33 +0000 |
commit | 3bed4af4f27bbd22b5531454095f0eda30bfac9f (patch) | |
tree | 250d302e861ff50390b42b78cdeba82b91496f0d /src/main/java/com/google/devtools/build/lib | |
parent | 279007ddfcdb6857b9c3cd3fcf015ba7f47a4c55 (diff) |
Use exec in py_binary to avoid child processes
The current approach for the py_binary wrapper means that deployed
instances of py_binary targets create child processes. This can be a
problem when you try to kill the py_binary target since signals and
such don't necessarily get passed along to the child process.
Using the exec functionality here should avoid this particular
problem. The overall behaviour should remain the same.
--
Change-Id: I20ef081e1da5b28a8aff8514d713b1c387ae7f7e
Reviewed-on: https://bazel-review.git.corp.google.com/#/c/4070/
MOS_MIGRATED_REVID=127929454
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt index f3fcc8c298..8e561a55c3 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt @@ -109,7 +109,7 @@ def Main(): try: sys.stdout.flush() - exit(subprocess.call(args)) + os.execv(args[0], args) except EnvironmentError as e: # This exception occurs when os.execv() fails for some reason. if not getattr(e, 'filename', None): |