Package nz.org.riskscape.cpython
Class CPythonSpawner.CPythonProcess
java.lang.Object
nz.org.riskscape.cpython.CPythonSpawner.CPythonProcess
- Enclosing class:
- CPythonSpawner
Simple class to help track child CPython processes that we spawn.
-
Constructor Summary
ConstructorDescriptionCPythonProcess
(Process proc, nz.org.riskscape.engine.resource.Resource script) -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
boolean
Simple test for checking the process finished successfully.getChild()
Writing to this stream will send data to the child process's stdinReading from this stream will receive data from the child process's stdoutnz.org.riskscape.engine.resource.Resource
boolean
boolean
isAlive()
toString()
boolean
-
Constructor Details
-
CPythonProcess
-
-
Method Details
-
getErrorText
- Returns:
- any stderr output produced by this process without buffering - returns what is available at the time without blocking (at least not on purpose)
-
hasErrorText
public boolean hasErrorText() -
exittedOK
public boolean exittedOK()Simple test for checking the process finished successfully. Don't call it unless you expect (and want) the process to have exitted, or you'll end up inadvertantly killing it by calling this function - it will forcibly destroy the process if it hasn't already exitted.
- Returns:
- true if the process exitted ok, waiting up to a minute for this to happen before killing it forcibly and returning false.
-
destroy
public void destroy() -
toString
-
isAlive
public boolean isAlive() -
wasDestroyed
public boolean wasDestroyed()- Returns:
- true if this process was destroyed by us (by calling destroy)
-
getChild
-
getUserScript
public nz.org.riskscape.engine.resource.Resource getUserScript() -
getChildStdIn
Writing to this stream will send data to the child process's stdin
-
getChildStdOut
Reading from this stream will receive data from the child process's stdout
-