Class ProcessSpawn

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getExitValue()
      If the process representes by this object has already exited, it returns the exit code.
      java.io.InputStream getStderr()
      Get a stream from which the Spawn's stderr can be read.
      java.io.OutputStream getStdin()
      Get a stream through which the Spawn's stdin can be written to.
      java.io.InputStream getStdout()
      Get a stream from which the Spawn's stdout can be read.
      boolean isClosed()
      Find out whether the Spawn has finished.
      void start()
      This method executes the given command within the specified time limit.
      void stop()
      This method stops the spawned process.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • stop

        public void stop()
        This method stops the spawned process.
        Specified by:
        stop in interface Spawnable
      • start

        public void start()
                   throws java.io.IOException
        This method executes the given command within the specified time limit. It starts the process thread and also the timer when enabled. It starts the piped streams to enable copying of process stream contents to standard streams.
        Specified by:
        start in interface Spawnable
        Throws:
        java.io.IOException - on trouble launching the process
      • getStdout

        public java.io.InputStream getStdout()
        Description copied from interface: Spawnable
        Get a stream from which the Spawn's stdout can be read.
        Specified by:
        getStdout in interface Spawnable
        Returns:
        the input stream of the process.
        See Also:
        Process.getInputStream()
      • getStdin

        public java.io.OutputStream getStdin()
        Description copied from interface: Spawnable
        Get a stream through which the Spawn's stdin can be written to.
        Specified by:
        getStdin in interface Spawnable
        Returns:
        the output stream of the process.
        See Also:
        Process.getOutputStream()
      • getStderr

        public java.io.InputStream getStderr()
        Description copied from interface: Spawnable
        Get a stream from which the Spawn's stderr can be read.
        Specified by:
        getStderr in interface Spawnable
        Returns:
        the error stream of the process.
        See Also:
        Process.getErrorStream()
      • isClosed

        public boolean isClosed()
        Description copied from interface: Spawnable
        Find out whether the Spawn has finished.
        Specified by:
        isClosed in interface Spawnable
        Returns:
        true if the process has exited.
      • getExitValue

        public int getExitValue()
                         throws ExpectJException
        If the process representes by this object has already exited, it returns the exit code. isClosed() should be used in conjunction with this method.
        Specified by:
        getExitValue in interface Spawnable
        Returns:
        The exit code of the finished process.
        Throws:
        ExpectJException - if the process is still running.
        See Also:
        Spawnable.isClosed(), System.exit(int)