Skip to content

Commit

Permalink
Wrap process.waitFor() in a try-finally that calls shutdown on proces…
Browse files Browse the repository at this point in the history
…s output reader threads (#94)

Fix for #93
  • Loading branch information
skidder authored and pfifer committed May 5, 2017
1 parent 23d4dfd commit 7f775d5
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,14 @@ public void apply(Logger logger, String message) {

executor.submit(stdOutReader);
executor.submit(stdErrReader);
int code = process.waitFor();

stdOutReader.shutdown();
stdErrReader.shutdown();
deletePipes();
fatalError("Child process exited with code " + code, code != 1);
try {
int code = process.waitFor();
fatalError("Child process exited with code " + code, code != 1);
} finally {
stdOutReader.shutdown();
stdErrReader.shutdown();
deletePipes();
}
}

private void updateCredentials() throws InterruptedException {
Expand Down

0 comments on commit 7f775d5

Please sign in to comment.