Skip to content

Commit 3bed4af

Browse files
Philipp Schraderkatre
authored andcommitted
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
1 parent 279007d commit 3bed4af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/google/devtools/build/lib/bazel/rules/python/stub_template.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def Main():
109109

110110
try:
111111
sys.stdout.flush()
112-
exit(subprocess.call(args))
112+
os.execv(args[0], args)
113113
except EnvironmentError as e:
114114
# This exception occurs when os.execv() fails for some reason.
115115
if not getattr(e, 'filename', None):

0 commit comments

Comments
 (0)