Skip to content

Commit

Permalink
Merge pull request #383 from res0nance/reduce-thread
Browse files Browse the repository at this point in the history
Close stdin once shell is deleted
  • Loading branch information
thoulen committed Jul 31, 2019
2 parents cd88f92 + 1566ddc commit dc79f4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/hudson/plugins/ec2/win/EC2WindowsLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ protected void launchScript(EC2Computer computer, TaskListener listener) throws
: "C:\\Windows\\Temp\\");

logger.println("Creating tmp directory if it does not exist");
connection.execute("if not exist " + tmpDir + " mkdir " + tmpDir);
WindowsProcess mkdirProcess = connection.execute("if not exist " + tmpDir + " mkdir " + tmpDir);
int exitCode = mkdirProcess.waitFor();
if (exitCode != 0) {
logger.println("Creating tmpdir failed=" + exitCode);
return;
}

if (initScript != null && initScript.trim().length() > 0 && !connection.exists(tmpDir + ".jenkins-init")) {
logger.println("Executing init script");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public synchronized int waitFor() {
} finally {
client.deleteShell();
terminated = true;
Closeables.closeQuietly(toCallersStdin);
}
return client.exitCode();
} catch (InterruptedException exc) {
Expand Down

0 comments on commit dc79f4e

Please sign in to comment.