Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,17 @@ public void run() {

timeoutHandlerDone.countDown();

// JDK 1.8 introduces a Process.waitFor(timeout) method which could
// be used here. We need run on 1.5 so using interrupt() instead.
victim.interrupt();
// unlock the main thread if the process fails
// to exit
try {
if (!process.waitFor(timeout, TimeUnit.SECONDS)) {
victim.interrupt();
}
}
catch (InterruptedException e) {
log.println("Interrupted exception: " + e);
victim.interrupt();
}
}
};
timeoutHandlerThread.setName("Timeout Handler for " + cmd.get(0));
Expand Down