This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 0be1b361c86a chore: Track PID in nohup execution for JBang integration
tests
0be1b361c86a is described below
commit 0be1b361c86aed6d1e606571199c9705bc781ebe
Author: Jakub Vrubel <[email protected]>
AuthorDate: Mon Aug 3 12:57:04 2026 +0200
chore: Track PID in nohup execution for JBang integration tests
Add executeNohup method to CliService/CliLocalProcessService that captures
the PID of nohup-launched processes via echo $!, so they are properly
cleaned up by stopBackgroundProcesses() during test teardown. Previously
nohup processes were never tracked and could leak.
Closes #25308
---
.../apache/camel/dsl/jbang/it/support/JBangTestSupport.java | 2 +-
.../camel/test/infra/cli/services/CliLocalProcessService.java | 11 +++++++++++
.../org/apache/camel/test/infra/cli/services/CliService.java | 4 ++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
index 6382127dea4b..c633e07bd2ea 100644
---
a/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
+++
b/dsl/camel-jbang/camel-jbang-it/src/test/java/org/apache/camel/dsl/jbang/it/support/JBangTestSupport.java
@@ -148,7 +148,7 @@ public abstract class JBangTestSupport {
}
protected String execNohup(final String command) {
- return containerService.executeGenericCommand("nohup " +
getMainCommand() + " " + command + " &");
+ return containerService.executeNohup(command);
}
protected String mountPoint() {
diff --git
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
index 7fe9312b3ff8..d3226cb02632 100644
---
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
+++
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalProcessService.java
@@ -191,6 +191,17 @@ public class CliLocalProcessService implements CliService {
return cleanPid;
}
+ @Override
+ public String executeNohup(String command) {
+ String pidOutput = executeGenericCommand("nohup " + getMainCommand() +
" " + command + " & echo $!");
+ String pid = pidOutput.trim();
+ if (org.apache.camel.support.ObjectHelper.isNumber(pid)) {
+ backgroundPids.add(pid);
+ LOG.info("Tracking nohup background process with PID: {}", pid);
+ }
+ return pid;
+ }
+
@Override
public String executeGenericCommand(String command) {
return executeGenericCommand(command, false, false);
diff --git
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliService.java
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliService.java
index bd08ceae709d..2fd7026b7afa 100644
---
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliService.java
+++
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliService.java
@@ -51,6 +51,10 @@ public interface CliService extends BeforeEachCallback,
AfterEachCallback, TestS
String executeBackground(String command);
+ default String executeNohup(String command) {
+ return executeGenericCommand("nohup " + getMainCommand() + " " +
command + " &");
+ }
+
String executeGenericCommand(String command);
String executeGenericCommand(String command, Boolean getError, Boolean
expectFail);