From d818b192103e9995088da36ec43b28e6686c988c Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Wed, 13 Oct 2021 12:12:59 +0100 Subject: [PATCH] pip: entry_point: Add support for exit codes --- python/pip_install/extract_wheels/lib/bazel.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/pip_install/extract_wheels/lib/bazel.py b/python/pip_install/extract_wheels/lib/bazel.py index 9e39abb920..47af8197de 100644 --- a/python/pip_install/extract_wheels/lib/bazel.py +++ b/python/pip_install/extract_wheels/lib/bazel.py @@ -31,9 +31,10 @@ def generate_entry_point_contents(entry_point: str, shebang: str = "#!/usr/bin/e module, method = entry_point.split(":", 1) return textwrap.dedent("""\ {shebang} + import sys + from {module} import {method} if __name__ == "__main__": - from {module} import {method} - {method}() + sys.exit({method}()) """.format( shebang=shebang, module=module,