Skip to content

Commit

Permalink
Avoid the extra termination
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgraham committed Jan 23, 2025
1 parent d7562a5 commit 1f39b7d
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,36 +696,9 @@ public void doAfterTest() throws Exception {
out.println("isTerminated: false");
}
}
boolean failed = false;
for (IProcess process : processes) {
out.println("TERMINATING");
out.println("Process: " + process);

if (process instanceof RuntimeProcess runtimeProcess) {
Field field = RuntimeProcess.class.getDeclaredField("fProcess");
field.trySetAccessible();
Process javaProcess = (Process) field.get(runtimeProcess);
if (javaProcess == null) {
out.println("javaProcess: null");
} else {
javaProcess.destroy();
out.println("WAITING");
boolean waitFor = javaProcess.waitFor(1, TimeUnit.SECONDS);
out.println("waitFor: " + waitFor);
if (waitFor) {
out.println("exitValue: " + javaProcess.exitValue());
} else {
failed = true;
}
}
}
}
String info = byteArrayOutputStream.toString("UTF-8");
try {
fLaunch.terminate();
if (failed) {
throw new RuntimeException("Failed to terminate\ninfo:\n" + info);
}
} catch (DebugException e) {
IStatus status = e.getStatus();
if (status != null) {
Expand Down

0 comments on commit 1f39b7d

Please sign in to comment.