title: java.io.IOException: The pipe is being closed is thrown on Windows but works fine on Linux
body: <p>I'm trying to run commands using Runtime.getRuntime.exec() in Java.</p>
  
  <pre><code>Runtime r = Runtime.getRuntime(); 
  Process process = r.exec("telnet 172.16.221.87 "); 
  InputStream is = process.getInputStream(); 
  OutputStream os = process.getOutputStream(); 
  BufferedWriter br = new BufferedWriter(new OutputStreamWriter(os));
  br.write("ditech\r\n");
  br.flush(); // The exception is coming on last line that is br.flush();
  </code></pre>
  
  <p>When I run code in Linux, then its working fine. But when same code is run on Windows, it throws following error:</p>
  
  <pre><code>java.io.IOException: The pipe is being closed
          at java.io.FileOutputStream.writeBytes(Native Method)
          at java.io.FileOutputStream.write(Unknown Source)
          at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
          at java.io.BufferedOutputStream.flush(Unknown Source)
          at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)
          at sun.nio.cs.StreamEncoder.flush(Unknown Source)
          at java.io.OutputStreamWriter.flush(Unknown Source)
          at java.io.BufferedWriter.flush(Unknown Source)
          at com.telnet.ConnectToTelnet.doTelnet(ConnectToTelnet.java:132)
          at com.telnet.ConnectToTelnet.main(ConnectToTelnet.java:16)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
          at java.lang.reflect.Method.invoke(Unknown Source)
          at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
  </code></pre>