code: public int stopAndWait(long timeout, TimeUnit unit) {
      stop(timeout, unit);
      return (waitFor(timeout, unit) ? exitValue() : safeExitValue());
    }
docs: Terminates this {@link Process} and wait until the given timeout for this {@link Process} to stop.
  
  @param timeout long value to indicate the number of units in the timeout.
  @param unit {@link TimeUnit} of the timeout (e.g. seconds).
  @return the exit value for this {@link Process} when if it stops, or {@literal -1} if this {@link Process}
  does not stop within the given timeout.
  @see #stop(long, TimeUnit)
  @see #waitFor(long, TimeUnit)
  @see #safeExitValue()