/** * Stop pumping the streams. When a timeout is specified it it is not guaranteed that the pumper * threads are cleanly terminated. */ public void stop() throws IOException { if (inputStreamPumper != null) { inputStreamPumper.stopProcessing(); } stopThread(outputThread, stopTimeout); stopThread(errorThread, stopTimeout); stopThread(inputThread, stopTimeout); if (err != null && err != out) { try { err.flush(); } catch (final IOException e) { final String msg = "Got exception while flushing the error stream : " + e.getMessage(); DebugUtils.handleException(msg, e); } } if (out != null) { try { out.flush(); } catch (final IOException e) { final String msg = "Got exception while flushing the output stream"; DebugUtils.handleException(msg, e); } } if (caught != null) { throw caught; } }
/** * Set the <CODE>OutputStream</CODE> by means of which input can be sent to the process. * * @param os the <CODE>OutputStream</CODE>. */ public void setProcessInputStream(final OutputStream os) { if (input != null) { // if (input == System.in) { inputThread = createSystemInPump(input, os); // } else { // inputThread = createPump(input, os, true); // } } else { try { os.close(); } catch (final IOException e) { final String msg = "Got exception while closing output stream"; DebugUtils.handleException(msg, e); } } }