|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttcl.lang.process.TclProcess
public abstract class TclProcess
This abstract class represents a process that may be executed from Tcl. Individual platforms should create a subclass of TclProcess, which is instantiated with with TclProcess.newInstance(). This class is somewhat of a combination of java.lang.ProcessBuilder and java.lang.Process, with inspiration from the Java 1.7 API. It is provided to allow for better native process control than Java's APIs.
| Field Summary | |
|---|---|
protected List<String> |
command
The command words that will be executed |
protected Interp |
interp
The current interpreter |
protected IOException |
savedException
An exception to be thrown in the main thread, but caught in any child thread |
protected Redirect |
stderrRedirect
A tcl.lang.process.Redirect object specifying where stderr is redirected to |
protected Redirect |
stdinRedirect
A tcl.lang.process.Redirect object specifying where stdin is redirected from |
protected Redirect |
stdoutRedirect
A tcl.lang.process.Redirect object specifying where stdout is redirected to |
| Constructor Summary | |
|---|---|
TclProcess()
|
|
| Method Summary | |
|---|---|
abstract boolean |
canInheritFileDescriptors()
|
List<String> |
command()
|
abstract void |
destroy()
Kill the running process |
abstract int |
exitValue()
|
protected Map<String,String> |
getenv()
|
abstract int |
getPid()
|
Redirect |
getStderrRedirect()
|
Redirect |
getStdinRedirect()
|
Redirect |
getStdoutRedirect()
|
protected abstract int |
implWaitFor()
Platform-specific wait for the process to complete |
abstract boolean |
isStarted()
|
static TclProcess |
newInstance(Interp interp)
Create a new platform-specific instance of a TclProcess subclass. |
protected void |
saveIOException(IOException e)
|
void |
setCommand(List<String> command)
Set the command words to be executed |
void |
setStderrRedirect(Redirect stderrRedirect)
|
void |
setStdinRedirect(Redirect stdinRedirect)
|
void |
setStdoutRedirect(Redirect stdoutRedirect)
|
abstract void |
setWorkingDir(File workingDir)
|
abstract void |
start()
Start the process executing, and register streams with any STREAM redirects |
protected void |
throwAnyExceptions()
|
int |
waitFor()
Wait for the process to complete |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Redirect stdinRedirect
protected Redirect stdoutRedirect
protected Redirect stderrRedirect
protected List<String> command
protected Interp interp
protected IOException savedException
| Constructor Detail |
|---|
public TclProcess()
| Method Detail |
|---|
public static TclProcess newInstance(Interp interp)
interp - The current interpreter
public void setCommand(List<String> command)
command - Command words to be executedpublic List<String> command()
protected Map<String,String> getenv()
public abstract void start()
throws IOException
IOException
public abstract int exitValue()
throws IllegalThreadStateException
IllegalThreadStateException - if the process has not yet completed
public int waitFor()
throws IllegalThreadStateException,
InterruptedException,
IOException
IllegalThreadStateException - if the process has not yet been started
InterruptedException - if the process is interrupted
IOException
protected abstract int implWaitFor()
throws InterruptedException,
IOException
InterruptedException - if the process is interrupted
IOException
public abstract int getPid()
throws IllegalThreadStateException
IllegalThreadStateException - if the process has not yet startedpublic abstract boolean isStarted()
public abstract void setWorkingDir(File workingDir)
workingDir - Directory the process starts inpublic abstract void destroy()
public abstract boolean canInheritFileDescriptors()
public Redirect getStdinRedirect()
protected void saveIOException(IOException e)
e - Exception to throw later in the main thread
protected void throwAnyExceptions()
throws IOException
Exception - if any exception was passed to saveException()
IOException
public void setStdinRedirect(Redirect stdinRedirect)
throws TclException
stdinRedirect - the stdinRedirect to set
TclExceptionpublic Redirect getStdoutRedirect()
public void setStdoutRedirect(Redirect stdoutRedirect)
throws TclException
stdoutRedirect - the stdoutRedirect to set
TclExceptionpublic Redirect getStderrRedirect()
public void setStderrRedirect(Redirect stderrRedirect)
throws TclException
stderrRedirect - the stderrRedirect to set
TclException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||