private void execProcess(String process, ProcessResult processresult) throws KettleException { Process p = null; try { String errorMsg = null; // execute process try { p = data.runtime.exec(process); } catch (Exception e) { errorMsg = e.getMessage(); } if (p == null) { processresult.setErrorStream(errorMsg); } else { // get output stream processresult.setOutputStream( getOutputString(new BufferedReader(new InputStreamReader(p.getInputStream())))); // get error message processresult.setErrorStream( getOutputString(new BufferedReader(new InputStreamReader(p.getErrorStream())))); // Wait until end p.waitFor(); // get exit status processresult.setExistStatus(p.exitValue()); } } catch (IOException ioe) { throw new KettleException("IO exception while running the process " + process + "!", ioe); } catch (InterruptedException ie) { throw new KettleException( "Interrupted exception while running the process " + process + "!", ie); } catch (Exception e) { throw new KettleException(e); } finally { if (p != null) { p.destroy(); } } }