/** * Allows the caller to wait for the completion of the process, but no longer than a given * timeout value. * * @param timeout * The given timeout value (ms). * @return Process exit code or <code>Integer.MAX_VALUE</code>, if the process has not * finished yet. */ public int waitFor(long timeout) { synchronized (this) { if (getExitCode() == Integer.MAX_VALUE) { try { this.wait(timeout); } catch (InterruptedException e) { } } } return getExitCode(); } } // end of Runner