Suppress output when killing process tree on Windows

Replaces capture_output with stdout and stderr redirected to DEVNULL in subprocess.run for taskkill, preventing codec issues and suppressing command output.
This commit is contained in:
oop7
2025-11-29 14:44:39 +02:00
parent bcbfd6f605
commit 83d37676ae
+3 -1
View File
@@ -144,9 +144,11 @@ class DownloadThread(QThread):
if sys.platform == "win32": if sys.platform == "win32":
# Windows: Use taskkill to kill the entire process tree # Windows: Use taskkill to kill the entire process tree
# /T = kill child processes, /F = force kill # /T = kill child processes, /F = force kill
# Use subprocess.run with no encoding to avoid codec issues
subprocess.run( subprocess.run(
["taskkill", "/F", "/T", "/PID", str(pid)], ["taskkill", "/F", "/T", "/PID", str(pid)],
capture_output=True, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
creationflags=SUBPROCESS_CREATIONFLAGS, creationflags=SUBPROCESS_CREATIONFLAGS,
) )
logger.debug(f"Killed process tree on Windows (PID: {pid})") logger.debug(f"Killed process tree on Windows (PID: {pid})")