Skip to content

Commit 9ff567d

Browse files
committed
Improving PortUtils to exitCode when process ends abnormally
1 parent eaf228a commit 9ff567d

File tree

1 file changed

+11
-1
lines changed
  • dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils

1 file changed

+11
-1
lines changed

dd-java-agent/testing/src/main/groovy/datadog/trace/agent/test/utils/PortUtils.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,17 @@ public static void waitForPortToOpen(
115115
}
116116

117117
if (!process.isAlive()) {
118-
throw new RuntimeException("Process died before port " + port + " was opened");
118+
int exitCode = process.exitValue();
119+
if (exitCode != 0) {
120+
throw new RuntimeException(
121+
"Process exited abnormally exitCode="
122+
+ exitCode
123+
+ " before port="
124+
+ port
125+
+ " was opened");
126+
} else {
127+
throw new RuntimeException("Process died before port=" + port + " was opened");
128+
}
119129
}
120130

121131
if (isPortOpen(port)) {

0 commit comments

Comments
 (0)