private void waitForErrors(WriteStreamOld error,InputStream inputStream,InputStream errorStream) throws IOException {
  byte[] buffer=new byte[256];
  int stderrLen=0;
  int stdoutLen=0;
  if (inputStream == null || errorStream == null)   return;
  do {
    if ((stderrLen=errorStream.available()) > 0) {
      stderrLen=errorStream.read(buffer,0,buffer.length);
      if (stderrLen > 0) {
        error.write(buffer,0,stderrLen);
        continue;
      }
    }
    if ((stdoutLen=inputStream.available()) > 0) {
      stdoutLen=inputStream.read(buffer,0,buffer.length);
      if (stdoutLen > 0) {
        error.write(buffer,0,stdoutLen);
        continue;
      }
    }
    if (stderrLen < 0 && stdoutLen < 0)     return;
    stderrLen=errorStream.read(buffer,0,buffer.length);
    if (stderrLen > 0) {
      error.write(buffer,0,stderrLen);
      continue;
    }
    stdoutLen=inputStream.read(buffer,0,buffer.length);
    if (stdoutLen > 0) {
      error.write(buffer,0,stdoutLen);
      continue;
    }
  }
 while (!_isDead && (stderrLen >= 0 || stdoutLen >= 0));
}

private void waitForErrors ( WriteStreamOld error , InputStream inputStream , InputStream errorStream ) throws IOException { byte [ ] buffer = new byte [ 256 ] ; int stderrLen = 0 ; int stdoutLen = 0 ; if ( inputStream == null || errorStream == null ) return ; do { if ( ( stderrLen = errorStream . available ( ) ) > 0 ) { stderrLen = errorStream . read ( buffer , 0 , buffer . length ) ; if ( stderrLen > 0 ) { error . write ( buffer , 0 , stderrLen ) ; continue ; } } if ( ( stdoutLen = inputStream . available ( ) ) > 0 ) { stdoutLen = inputStream . read ( buffer , 0 , buffer . length ) ; if ( stdoutLen > 0 ) { error . write ( buffer , 0 , stdoutLen ) ; continue ; } } if ( stderrLen < 0 && stdoutLen < 0 ) return ; stderrLen = errorStream . read ( buffer , 0 , buffer . length ) ; if ( stderrLen > 0 ) { error . write ( buffer , 0 , stderrLen ) ; continue ; } stdoutLen = inputStream . read ( buffer , 0 , buffer . length ) ; if ( stdoutLen > 0 ) { error . write ( buffer , 0 , stdoutLen ) ; continue ; } } while ( ! _isDead && ( stderrLen >= 0 || stdoutLen >= 0 ) ) ; }
read any errors from the process .
