slachiewicz opened a new pull request, #185: URL: https://github.com/apache/maven-invoker/pull/185
Closes #135 (MSHARED-867). On timeout, `CommandLineUtils` destroys the process it started, which is the launcher shell (`/bin/sh -c … mvn` or `cmd.exe /C mvn.cmd`); the Maven JVM under it and the JVMs Maven forked kept running. That is what the old `buildShouldTimeout` worked around with a `@Test(timeout)` inside the fixture, and it happens on every OS, not only on Windows: without this change the test leaves the Maven JVM and a Surefire fork behind on macOS too. `DefaultInvoker` now builds a `Commandline` that remembers the process it starts, and uses the `CommandLineUtils` overload with the `runAfterProcessTermination` callback, which runs after a timeout while the launcher is still alive; the callback forcibly destroys every descendant through `ProcessHandle` (by reflection, the component targets Java 8; on Java 8 nothing changes) before `CommandLineUtils` destroys the launcher. `MavenCommandLineBuilder` gets a `protected createCommandline()` for that. The fixture's endless test now writes a heartbeat file, and `buildShouldTimeout` asserts the heartbeat stops after the timeout; it fails without the change (`the forked test JVM is still running`). The timeout goes from 4 s to 30 s so the nested build reaches the forked test before it fires. Verified: `mvn verify` → 110 tests, 0 failures. -- 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]
