1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-03 03:42:20 +01:00

Optimize subprocess performance with close_fds=False

This commit is contained in:
J. Nick Koston
2025-08-08 16:18:04 -05:00
parent ff9ddb9d68
commit 3ded96bb26
12 changed files with 40 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ def find_and_activate_virtualenv():
try:
# Get the top-level directory of the git repository
my_path = subprocess.check_output(
["git", "rev-parse", "--show-toplevel"], text=True
["git", "rev-parse", "--show-toplevel"], text=True, close_fds=False
).strip()
except subprocess.CalledProcessError:
print(
@@ -44,7 +44,7 @@ def find_and_activate_virtualenv():
def run_command():
# Execute the remaining arguments in the new environment
if len(sys.argv) > 1:
subprocess.run(sys.argv[1:], check=False)
subprocess.run(sys.argv[1:], check=False, close_fds=False)
else:
print(
"No command provided to run in the virtual environment.",