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:
@@ -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})")
|
||||||
|
|||||||
Reference in New Issue
Block a user