Class ProcessUtils.ProcessInfo<O extends java.util.function.Consumer<java.lang.String>,​E extends java.util.function.Consumer<java.lang.String>>

  • Enclosing class:
    ProcessUtils

    public static class ProcessUtils.ProcessInfo<O extends java.util.function.Consumer<java.lang.String>,​E extends java.util.function.Consumer<java.lang.String>>
    extends java.lang.Object
    • Constructor Detail

      • ProcessInfo

        public ProcessInfo​(java.lang.ProcessBuilder builder,
                           O stdout,
                           E stderr)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • ensureDestroyed

        public final void ensureDestroyed()
      • ensureDestroyed

        public final void ensureDestroyed​(long timeout,
                                          java.util.concurrent.TimeUnit unit)
      • getCommandLine

        public java.lang.String getCommandLine()
      • getExitCode

        public final int getExitCode()
                              throws java.lang.IllegalThreadStateException
        Throws:
        java.lang.IllegalThreadStateException
      • getExitCodeQuietly

        public final int getExitCodeQuietly​(int defaultValue)
      • getStderr

        public E getStderr()
      • getStdout

        public O getStdout()
      • isAlive

        public final boolean isAlive()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • waitFor

        public final ProcessUtils.ProcessInfo<O,​E> waitFor()
                                                          throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • waitFor

        public final boolean waitFor​(long timeout,
                                     java.util.concurrent.TimeUnit unit)
                              throws java.lang.InterruptedException
        Causes the current thread to wait, if necessary, until the subprocess represented by this ProcessInfo object has terminated, or the specified waiting time elapses. If the subprocess has already terminated then this method returns immediately with the value true. If the process has not terminated and the timeout value is less than, or equal to, zero, then this method returns immediately with the value false.
        Parameters:
        timeout - the maximum time to wait
        unit - the time unit of the timeout argument
        Returns:
        true if the subprocess has exited and false if the waiting time elapsed before the subprocess has exited.
        Throws:
        java.lang.InterruptedException - if the current thread is interrupted while waiting.
        java.lang.NullPointerException - if unit is null