Skip to content

Commit 83d3767

Browse files
committed
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.
1 parent bcbfd6f commit 83d3767

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/core/ytsage_downloader.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ def _terminate_process_tree(self, process: subprocess.Popen) -> None:
144144
if sys.platform == "win32":
145145
# Windows: Use taskkill to kill the entire process tree
146146
# /T = kill child processes, /F = force kill
147+
# Use subprocess.run with no encoding to avoid codec issues
147148
subprocess.run(
148149
["taskkill", "/F", "/T", "/PID", str(pid)],
149-
capture_output=True,
150+
stdout=subprocess.DEVNULL,
151+
stderr=subprocess.DEVNULL,
150152
creationflags=SUBPROCESS_CREATIONFLAGS,
151153
)
152154
logger.debug(f"Killed process tree on Windows (PID: {pid})")

0 commit comments

Comments
 (0)