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 intgetExitValue()If the process representes by this object has already exited, it returns the exit code.java.io.InputStreamgetStderr()Get a stream from which theSpawn's stderr can be read.java.io.OutputStreamgetStdin()Get a stream through which theSpawn's stdin can be written to.java.io.InputStreamgetStdout()Get a stream from which theSpawn's stdout can be read.booleanisClosed()Find out whether theSpawnhas finished.voidstart()This method executes the given command within the specified time limit.voidstop()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.IOExceptionThis 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:SpawnableGet a stream from which theSpawn's stdout can be read.
-
getStdin
public java.io.OutputStream getStdin()
Description copied from interface:SpawnableGet a stream through which theSpawn's stdin can be written to.
-
getStderr
public java.io.InputStream getStderr()
Description copied from interface:SpawnableGet a stream from which theSpawn's stderr can be read.
-
isClosed
public boolean isClosed()
Description copied from interface:SpawnableFind out whether theSpawnhas finished.
-
getExitValue
public int getExitValue() throws ExpectJExceptionIf 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:
getExitValuein interfaceSpawnable- Returns:
- The exit code of the finished process.
- Throws:
ExpectJException- if the process is still running.- See Also:
Spawnable.isClosed(),System.exit(int)
-
-