plugin: _execute_commands_in_subprocess: make sure pipes get closed

This commit is contained in:
SomberNight
2025-05-22 21:48:27 +00:00
parent ddaa204b70
commit 9b24316915
+3 -3
View File
@@ -338,12 +338,12 @@ class Plugins(DaemonThread):
Executes the given commands in a subprocess and asserts that it was successful.
"""
import subprocess
process = subprocess.Popen(
with subprocess.Popen(
commands,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)
text=True,
) as process:
stdout, stderr = process.communicate()
if process.returncode != 0:
raise Exception(f'error executing command ({process.returncode}): {stderr}')