Skip to content

CommandLineUtils: ensure all pumpers are waited on in try-finally#399

Open
elharo wants to merge 1 commit into
masterfrom
fix/commandlineutils-inputfeeder-cleanup
Open

CommandLineUtils: ensure all pumpers are waited on in try-finally#399
elharo wants to merge 1 commit into
masterfrom
fix/commandlineutils-inputfeeder-cleanup

Conversation

@elharo

@elharo elharo commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

In CommandLineUtils.call(), waitUntilDone() was called on inputFeeder, outputPumper, and errorPumper sequentially without try-finally (lines 298-303 of the original). If an earlier call threw (e.g., InterruptedException), the remaining pumpers were never waited on, leaving their threads potentially running.

The commented-out code just above (lines 277-297) shows the original author intended a try-finally chain but never enabled it.

Fix: Replaced the sequential calls and the dead commented block with a proper try-finally chain ensuring all three pumpers are waited on regardless of exceptions from earlier ones.

Fixes #398

@elharo elharo requested a review from cstamas July 1, 2026 14:18
@slachiewicz slachiewicz added the bug Something isn't working label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CommandLineUtils.call() does not ensure all pumpers are waited on

2 participants