1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-07 20:33:47 +01:00

Optimize subprocess performance with close_fds=False (#10145)

This commit is contained in:
J. Nick Koston
2025-08-10 16:14:13 -05:00
committed by GitHub
parent 279f56141e
commit 5a8f722316
12 changed files with 40 additions and 13 deletions

View File

@@ -239,7 +239,12 @@ def run_external_process(*cmd: str, **kwargs: Any) -> int | str:
try:
proc = subprocess.run(
cmd, stdout=sub_stdout, stderr=sub_stderr, encoding="utf-8", check=False
cmd,
stdout=sub_stdout,
stderr=sub_stderr,
encoding="utf-8",
check=False,
close_fds=False,
)
return proc.stdout if capture_stdout else proc.returncode
except KeyboardInterrupt: # pylint: disable=try-except-raise