1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-08 12:53:45 +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

@@ -114,7 +114,9 @@ def cpp_string_escape(string, encoding="utf-8"):
def run_system_command(*args):
import subprocess
with subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as p:
with subprocess.Popen(
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=False
) as p:
stdout, stderr = p.communicate()
rc = p.returncode
return rc, stdout, stderr