Skip to content

fix: drain process output before returning, kill orphaned speedtest, thread-safe capture#927

Merged
laurentiu021 merged 1 commit into
mainfrom
fix/p2-process-plumbing
Jun 17, 2026
Merged

fix: drain process output before returning, kill orphaned speedtest, thread-safe capture#927
laurentiu021 merged 1 commit into
mainfrom
fix/p2-process-plumbing

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

External-process plumbing defects across the shared runner and two consumers.

Changes

  • PowerShellRunner.RunProcessAsyncWaitForExitAsync returns when the process exits, but the async BeginOutputReadLine/BeginErrorReadLine pumps may not have raised their final lines, so callers that snapshot output immediately lost the last lines (e.g. NetworkRepair, chkdsk, winget). Added a proc.WaitForExit() (on a thread-pool thread, only when not cancelled) to block until both readers reach end-of-stream. Fixes the truncation at the seam for all consumers.
  • SpeedTestService.RunOoklaAsync — cancellation/timeout during the parallel stdout/stderr ReadToEndAsync propagated before the try/catch that kills the child, orphaning speedtest.exe. Wrapped the reads + wait in one try; the OperationCanceledException catch now kills the process tree on any cancellation path.
  • SystemHealthViewModel (chkdsk) and WingetService (upgrade scan) — both collected output into a plain List<string> written by the concurrent stdout+stderr reader threads (data race: dropped/corrupted lines). Switched to ConcurrentQueue<string>, materialized (ToArray()/ToList()) before parsing.

Tests

  • Existing WingetService/SystemHealth parse tests still pass (the parsers are unchanged; only the collector type changed). The concurrency/orphan-kill paths require live process I/O and aren't unit-testable; they mirror the audit's recommended fixes.

Build: 0 warnings / 0 errors. Version 1.20.38.

@laurentiu021 laurentiu021 merged commit 4cb7083 into main Jun 17, 2026
4 checks passed
@laurentiu021 laurentiu021 deleted the fix/p2-process-plumbing branch June 17, 2026 16:30
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.

1 participant