davsclaus opened a new pull request, #29982: URL: https://github.com/apache/camel/pull/29982
A point of item 7 of [CAMEL-26930](https://issues.apache.org/jira/browse/CAMEL-26930). ## Problem `camel run --example X` copies (or downloads) the example into a `camel-example-*` folder in the temporary directory. In the foreground the folder is deleted when the run ends. In the background it is kept, as the integration outlives the `camel run` that made it (CAMEL-25425), but nothing deleted it when the integration ended: after `camel stop` it stayed in the temporary directory. Only the TUI cleans such folders. On the launcher, `camel run --example timer-log --background`, then `camel stop timer-log`: ``` main: /var/folders/.../T/camel-example-14297257269760671735 left behind this branch: gone ``` ## Change The `camel run` of the example gives the folder to the run it starts in the background, in the environment variable `CAMEL_CLI_EXAMPLE_DIR`, and the JVM that runs the integration (the spawned run) deletes the folder when it exits, such as by `camel stop`. It deletes it only when it is a `camel-example-*` folder directly in the temporary directory, so a value set by hand cannot remove another folder. A run that is killed hard still leaves it, for the stale-folder cleanup of the TUI. ## Tests - `ExampleHelperExampleDirTest` (new): an example folder in the temporary directory is taken; another folder, one not directly in the temporary directory, one that does not exist, and none are left alone. - End to end with the launcher, before and after, as above. - camel-jbang-core: 3089 + 266 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]
