Skip to content

Commit

Permalink
fix: do not close stdin except with system property
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo committed May 11, 2023
1 parent b494194 commit cebf9fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/com/aws/greengrass/util/Exec.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,12 @@ public Optional<Integer> exec() throws InterruptedException, IOException {
}
process = createProcess();
logger.debug("Created process with pid {}", getPid());
// Close stdin, no one can write anything to stdin.
process.getOutputStream().close();

// By default, do not close stdin.
if ("true".equalsIgnoreCase(System.getProperty("gg.closeStdIn", "false"))) {
// Close stdin, no one can write anything to stdin.
process.getOutputStream().close();
}

stderrc = new Copier(process.getErrorStream(), stderr);
stdoutc = new Copier(process.getInputStream(), stdout);
Expand Down

0 comments on commit cebf9fd

Please sign in to comment.