Skip to content

Poll System.in for stdin in CommandLineUtils.executeCommandLine - #351

Merged
slachiewicz merged 1 commit into
masterfrom
agent/stream-poll-feeder
Nov 9, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/stream-poll-feeder

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Ports StreamPollFeeder from Maven Shared Utils (apache/maven-shared-utils#140, MSHARED-1072), which polls available() with a short sleep instead of blocking in read(), and uses it when systemIn is System.in. Other streams keep StreamFeeder: available() == 0 does not mean end of input for them, so polling would never close the process stdin.

Closes #260

Verified: mvn -B -ntp verify → BUILD SUCCESS, 257 tests, 0 failures, 3 skipped; the System.in test times out on master (macOS, JDK 17)

A process that exits without reading stdin no longer leaves the caller
waiting in a blocking read of System.in. Other input streams keep using
StreamFeeder, because available() == 0 does not mean end of input for
them and the process would never see EOF.
@slachiewicz slachiewicz added the enhancement New feature or request label Nov 8, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review November 9, 2026 07:19
@slachiewicz
slachiewicz merged commit 1b3f665 into master Nov 9, 2026
13 checks passed
@slachiewicz
slachiewicz deleted the agent/stream-poll-feeder branch November 9, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poll data from input stream

1 participant