public int waitFor(long timeout) throws InterruptedException, TimeoutException
{
if(_process == null)
throw new IllegalStateException("you must call start first");
Chronos c = new Chronos();
_out.join(timeout);
timeout -= c.tick();
if (timeout <= 0)
throw new TimeoutException("Wait timed out");
_err.join(timeout);
timeout -= c.tick();
if (timeout <= 0)
throw new TimeoutException("Wait timed out");
// there is no timeout in this API, not much we can do here
// waiting on the other two threads should give us some safety