docs: public static int waitForWithTimeout(final Process p, long timeout, TimeUnit unit)
        throws TimeoutException {
  
      ProcessThread t = new ProcessThread(p);
      t.start();
      try {
        unit.timedJoin(t, timeout);
  
      } catch (InterruptedException e) {
        t.interrupt();
        Thread.currentThread().interrupt();
      }
  
      if (!t.hasFinished()) {
        throw new TimeoutException("Process did not finish within timeout");
      }
  
      return t.exitValue();
    }