Skip to content

Drain taskkill's output so a large force-stop doesn't stall - #46

Merged
HalRiveria-Bot merged 2 commits into
mainfrom
fix/taskkill-pipe-stall
Nov 17, 2026
Merged

HalRiveria-Bot merged 2 commits into
mainfrom
fix/taskkill-pipe-stall

Conversation

@HalRiveria-Bot

Copy link
Copy Markdown
Collaborator

What was wrong: Stop-PkProcessTree redirected taskkill's stdout and stderr but never read them. taskkill prints a line per process it kills (three for a cmd /c tool job), so once about 20 jobs were running the pipe filled and taskkill blocked. The 10 s wait then gave up, and the fallback Kill() only reached the top-level processes, leaving their children running. Every force-stop and teardown kills all running jobs in one call, so any batch running that many jobs at once could hit it.

What changed: both pipes are read (ReadToEndAsync()) as soon as taskkill starts, and the reads get a short bounded wait once it exits.

Tested: new harness assertion: 40 cmd /c ping trees through Stop-PkProcessTree, all gone in under 5 s. Before the fix it took 10 s on both runtimes and left 19 pings running on 5.1. After it, 0.2 s with none left on both. Full harness passes on Windows PowerShell 5.1 and PowerShell 7.

🤖 Generated with Claude Code

@HalRiveria-Bot
HalRiveria-Bot merged commit 42a1dcd into main Nov 17, 2026
2 checks passed
@HalRiveria-Bot
HalRiveria-Bot deleted the fix/taskkill-pipe-stall branch November 17, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants