davsclaus opened a new pull request, #29973: URL: https://github.com/apache/camel/pull/29973
The first point of item 7 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930). ## Problem `camel run --jvm-args=...` and `--jvm-debug` (and a run of another Camel version) run the integration in a JVM of its own, in the foreground, and wait for it. Ctrl+C reaches both JVMs, but a kill of `camel run` (SIGTERM, as a supervisor or an agent sends it) reaches only the CLI JVM, and nothing stopped the child: it went on running without its parent. On the launcher, `camel run r.camel.yaml --jvm-args=-Xmx256m`, then `kill -TERM` of the CLI JVM: ``` main: cli gone child ALIVE (orphan), still logging "tick" this branch: cli gone child gone ``` ## Change `Run.waitForChild` waits for the child with a shutdown hook that stops it (`ChildProcess.stop`: gracefully, then forcibly after 30 seconds), as the Spring Boot, Quarkus and Camel Main runners and the example run do already, and removes the hook when the child ended by itself. It is used by the three foreground paths: `runLauncherJvm` (`--jvm-args`, `--jvm-debug`), `runCamelVersion` and `runCustomCamelVersion`. ## Tests - `RunChildStopTest` (new): the hook stops a running child process (not on Windows, which has no `sleep`). - End to end with the launcher, before and after, as above. - camel-jbang-run: 319 pass. camel-jbang-core: 3070 + 264 pass. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
