Affected version
1.0.0
Bug description
ForkedMavenExecutor cannot be given an interactive stdin. ProcessBuilderExecutorSupport.pump() starts three pump threads and returns a CountDownLatch(3); execute() then does latch.await() (or await(timeout)) before reading the exit code (ProcessBuilderExecutorSupport.java:83-98,118-160). The stdin pump runs IOTools.transferTo(stdIn, process.getOutputStream()), which blocks in read() on the caller's stream until EOF. With stdIn(System.in):
- without a timeout,
execute() never returns after the child exits, because the console never reaches EOF;
- with a timeout,
await times out and the child is destroyForcibly()-ed, so a build that was already finished is reported as Process timeout.
This is exactly the request maven-invoker's setInputStream(System.in) serves in maven-release's InvokerMavenExecutor (interactive prompts from the forked build, such as a GPG passphrase) and in maven-gpg-plugin's tests, so those two consumers cannot migrate to maven-executor until the pump either stops when the process exits or the executor waits on the process first and then only on the stdout/stderr pumps.
Proposal: waitFor() the process, then await the two output pumps, and interrupt or abandon the stdin pump; do not count it in the latch. Related: #45 (streams closed by the pumps) and the runtime section of #49.
Affected version
1.0.0
Bug description
ForkedMavenExecutorcannot be given an interactive stdin.ProcessBuilderExecutorSupport.pump()starts three pump threads and returns aCountDownLatch(3);execute()then doeslatch.await()(orawait(timeout)) before reading the exit code (ProcessBuilderExecutorSupport.java:83-98,118-160). The stdin pump runsIOTools.transferTo(stdIn, process.getOutputStream()), which blocks inread()on the caller's stream until EOF. WithstdIn(System.in):execute()never returns after the child exits, because the console never reaches EOF;awaittimes out and the child isdestroyForcibly()-ed, so a build that was already finished is reported asProcess timeout.This is exactly the request maven-invoker's
setInputStream(System.in)serves in maven-release'sInvokerMavenExecutor(interactive prompts from the forked build, such as a GPG passphrase) and in maven-gpg-plugin's tests, so those two consumers cannot migrate to maven-executor until the pump either stops when the process exits or the executor waits on the process first and then only on the stdout/stderr pumps.Proposal:
waitFor()the process, then await the two output pumps, and interrupt or abandon the stdin pump; do not count it in the latch. Related: #45 (streams closed by the pumps) and the runtime section of #49.