Skip to content

Commit 826ad69

Browse files
committed
processBuilder.inheritIO
1 parent b7d746e commit 826ad69

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-ant/src/test/java/smoketest/ant/SampleAntApplicationIT.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void runJar() throws Exception {
3939
File libs = new File("build/ant/libs");
4040
String javaExecutable = findJavaExecutable();
4141
ProcessBuilder processBuilder = new ProcessBuilder(javaExecutable, "-jar", "spring-boot-smoke-test-ant.jar");
42+
processBuilder.inheritIO();
4243
Process process = processBuilder.directory(libs).start();
4344
process.waitFor(5, TimeUnit.MINUTES);
4445
assertThat(process.exitValue()).isZero();
@@ -47,7 +48,16 @@ void runJar() throws Exception {
4748
}
4849

4950
private String findJavaExecutable() {
50-
// Fallback to PATH first in CI environment
51+
// Use the same Java executable that's running the current JVM
52+
String javaHome = System.getProperty("java.home");
53+
if (javaHome != null) {
54+
File javaExecutable = new File(javaHome, "bin/java");
55+
if (javaExecutable.exists()) {
56+
return javaExecutable.getAbsolutePath();
57+
}
58+
}
59+
60+
// Fallback to PATH
5161
return "java";
5262
}
5363

0 commit comments

Comments
 (0)