title: Java Process Builder builds the process successfully but when flushing information returns Stream closed (java.ioException)
body: <p>Environment Information</p>
  <p>OS: Linux( java program running in a docker container)</p>
  <p>Java version: 1.8</p>
  <p>Node version: 10.22.1</p>
  <p>I am trying to create a process from an executable js file with the java ProcessBuilder class like below:</p>
  <pre><code>String command = &quot;/node/app/bin/app.js&quot;
  final ProcessBuilder pb = new ProcessBuilder(command);
  Process process = pb.start();
  OutputStream out = process.getOutputStream();
   out.write(&quot;\n[:--:]&quot;.getBytes());
  out.flush();// this line throws the error java.io.IOException: Stream closed
  </code></pre>
  <p>After running the <code>pb.start()</code> the process is created successfully, below is the debug information:
  <a href="https://i.stack.imgur.com/6jEAP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6jEAP.png" alt="enter image description here" /></a></p>
  <p>The problem is when the <code>out.flush()</code> command which throws an exception when executed. Below is the execution error:</p>
  <pre><code>Caused by: java.io.IOException: Stream closed
  
  at java.lang.ProcessBuilder$NullOutputStream.write(ProcessBuilder.java:433) ~[?:1.8.0_292]
  
  at java.io.OutputStream.write(OutputStream.java:116) ~[?:1.8.0_292]
  
  at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) ~[?:1.8.0_292]
  
  at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) ~[?:1.8.0_292]
  </code></pre>
  <p>The <code>/node/app/bin/app.js</code> content is like below:</p>
  <pre><code>#!/usr/bin/env node
  var path = require('path');
  
  var apJsFile = path.resolve(__dirname, '../app.js'); //app.js is working correctly
  
  require(appJsFile);
  </code></pre>