davsclaus opened a new pull request, #30321: URL: https://github.com/apache/camel/pull/30321
[CAMEL-27149](https://issues.apache.org/jira/browse/CAMEL-27149): `camel stop <pid>` can now be given the pid of the process that launched an integration, such as the shell or the JBang launcher of `camel run`. It stops the Camel integrations that process launched. Before 4.24.0 ships, this restores what Citrus relies on. ### The regression Since CAMEL-26911 and CAMEL-26929, `camel stop <pid>` accepts only the pid of a running Camel integration, and exits `3` for any other pid. In 4.23 a numeric pid was used as given, so the process got a SIGTERM. Citrus (`CamelStopIntegrationAction`) keeps the pid of the process it started. On Linux that is the launcher, while the Camel JVM is its child: 3469 and 3470, 3906 and 3907, and so on. At the end of each test Citrus runs `camel stop 3469`, and it stops the children only after that command succeeds. With 4.24.0-SNAPSHOT: - the command exits `3`; - every Citrus test fails in its final actions; - the integrations are never stopped. The integration tests of camel-kamelets on 4.24.0-SNAPSHOT (apache/camel-kamelets#3186) show it: 35 tests failed with `Failed to stop Camel integration - exit code 3`, and the runner was shut down. ### The fix When the pid is not a Camel integration, `StopProcess` takes the running Camel integrations that are descendants of that process, and stops them as it does any integration: it deletes the pid file, and waits. Two things do not change: - **The CAMEL-26911 safety:** the launcher, or any other process that is not a Camel integration, is never signalled. - **A pid with no integration below it** still exits `3`. ``` $ camel stop 27880 PID 27880 is not a Camel integration: stopping the Camel integration it launched Shutting down Camel integration (PID: 27883) ``` The `camel stop` section of the docs says so. ### Tests - `StopProcessTest`: - the pid of a launcher stops the integration it launched, and the launcher is never signalled; - a pid whose child is not an integration fails with exit `3`, and nothing is signalled. The process and common tests of camel-jbang-core (761) pass. - **End to end:** I started an integration as Citrus does on Linux, under a parent process (`bash -c "jbang camel@apache/camel run tick.yaml; true"`), then ran `camel stop <parent pid>`: | CLI | Exit | Integration | |---|---|---| | main | `3`, "No running Camel integration matches: 28170" | still running | | this PR | `0` | stopped, and the parent exited | _Claude Code on behalf of Claus Ibsen_ 🤖 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]
