Skip to content

Commit cebf9fd

Browse files
committed
fix: do not close stdin except with system property
1 parent b494194 commit cebf9fd

File tree

1 file changed

+6
-2
lines changed
  • src/main/java/com/aws/greengrass/util

1 file changed

+6
-2
lines changed

src/main/java/com/aws/greengrass/util/Exec.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,12 @@ public Optional<Integer> exec() throws InterruptedException, IOException {
315315
}
316316
process = createProcess();
317317
logger.debug("Created process with pid {}", getPid());
318-
// Close stdin, no one can write anything to stdin.
319-
process.getOutputStream().close();
318+
319+
// By default, do not close stdin.
320+
if ("true".equalsIgnoreCase(System.getProperty("gg.closeStdIn", "false"))) {
321+
// Close stdin, no one can write anything to stdin.
322+
process.getOutputStream().close();
323+
}
320324

321325
stderrc = new Copier(process.getErrorStream(), stderr);
322326
stdoutc = new Copier(process.getInputStream(), stdout);

0 commit comments

Comments
 (0)