Class ProcessSpawn
- java.lang.Object
-
- com.santaba.agent.groovyapi.expect.expectj.AbstractSpawnable
-
- com.santaba.agent.groovyapi.expect.expectj.ProcessSpawn
-
- All Implemented Interfaces:
Spawnable
public class ProcessSpawn extends AbstractSpawnable implements Spawnable
This class spawns a process that ExpectJ can control.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.santaba.agent.groovyapi.expect.expectj.Spawnable
Spawnable.CloseListener
-
-
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 theSpawn
's stderr can be read.java.io.OutputStream
getStdin()
Get a stream through which theSpawn
's stdin can be written to.java.io.InputStream
getStdout()
Get a stream from which theSpawn
's stdout can be read.boolean
isClosed()
Find out whether theSpawn
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 com.santaba.agent.groovyapi.expect.expectj.AbstractSpawnable
onClose, setCloseListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.santaba.agent.groovyapi.expect.expectj.Spawnable
setCloseListener
-
-
-
-
Method Detail
-
stop
public void stop()
This method stops the spawned process.
-
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.
-
getStdout
public java.io.InputStream getStdout()
Description copied from interface:Spawnable
Get a stream from which theSpawn
's stdout can be read.
-
getStdin
public java.io.OutputStream getStdin()
Description copied from interface:Spawnable
Get a stream through which theSpawn
's stdin can be written to.
-
getStderr
public java.io.InputStream getStderr()
Description copied from interface:Spawnable
Get a stream from which theSpawn
's stderr can be read.
-
isClosed
public boolean isClosed()
Description copied from interface:Spawnable
Find out whether theSpawn
has finished.
-
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 interfaceSpawnable
- Returns:
- The exit code of the finished process.
- Throws:
ExpectJException
- if the process is still running.- See Also:
Spawnable.isClosed()
,System.exit(int)
-
-