slachiewicz opened a new issue, #50: URL: https://github.com/apache/maven-executor/issues/50
### 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](https://github.com/apache/maven-executor/blob/main/maven-executor/src/main/java/org/apache/maven/executor/support/ProcessBuilderExecutorSupport.java)). 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
