title: Node.js child.stdin.write doesn't work
body: <p>when I try to run child process and put to it stdin some text it throws error.
  here is code of child process:</p>
  
  <pre><code>import java.io.Console;
  
  public class HelloWorld {
      public static void main(String[] args) {
          System.out.println("started");
  
          Console console = System.console();
  
          while (true) {
              String s = console.readLine();
              System.out.println("Your sentence:" + s);
          }
      }
  }
  </code></pre>
  
  <p>code of script which run this process:</p>
  
  <pre><code>var spawn = require('child_process').spawn;
  
  var child = spawn('java', ['HelloWorld', 'HelloWorld.class']);
  
  
  child.stdin.setEncoding('utf-8');
  
  child.stdout.pipe(process.stdout);
  
  
  child.stdin.write("tratata\n");
  
  // child.stdin.end();
  </code></pre>
  
  <p>it throws:</p>
  
  <pre><code>events.js:161
    throw er; // Unhandled 'error' event
    ^
  
  Error: read ECONNRESET
      at exports._errnoException (util.js:1028:11)
      at Pipe.onread (net.js:572:26)
  </code></pre>
  
  <p>notice, when I uncomment line with child.stdin.end(); it only ends whithout any reaction</p>