From d02ca056a376a36cb704e290f6188734d7a9e5bb Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Fri, 9 Sep 2022 10:27:15 -0700 Subject: [PATCH] Don't close file descriptors when starting python program Python programs run via a wrapper script. That wrapper script can be started with open file descriptors, for example by using the <(echo foo) syntax in bash. The shouldn't be closed when starting the real script. Bug: 203436762 Test: Presubmits Change-Id: Ib20450f713b15c8a5527d1e433bfd9635cead85f --- python/scripts/stub_template_host.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/scripts/stub_template_host.txt b/python/scripts/stub_template_host.txt index 138404bf3..23897b30b 100644 --- a/python/scripts/stub_template_host.txt +++ b/python/scripts/stub_template_host.txt @@ -81,7 +81,9 @@ def Main(): os.environ.update(new_env) sys.stdout.flush() - retCode = subprocess.call(args) + # close_fds=False so that you can run binaries with files provided on the command line: + # my_python_app --file <(echo foo) + retCode = subprocess.call(args, close_fds=False) sys.exit(retCode) except: raise