public class ScriptRunner
extends java.lang.Object
Constructor and Description |
---|
ScriptRunner() |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.String> |
environment()
Gets the mutable map of environment variables to add to the child process environment.
|
protected long |
getScriptTimeoutS() |
int |
runScript(java.lang.String scriptPath,
ScriptOutputHandler outputHandler,
java.lang.String... args) |
int |
runScript(java.lang.String scriptPath,
java.lang.String... args)
Runs a script with IO inherited from the current Java process.
|
protected long getScriptTimeoutS()
public int runScript(java.lang.String scriptPath, java.lang.String... args) throws java.io.IOException, java.lang.InterruptedException
scriptPath
- the path to the script file.args
- the command line args to pass to the script.java.io.IOException
- if there was a problem running the process.java.lang.InterruptedException
- if the thread is interrupted while waiting for the process to finish.public int runScript(java.lang.String scriptPath, ScriptOutputHandler outputHandler, java.lang.String... args) throws java.io.IOException, java.lang.InterruptedException
scriptPath
- the path to the script file.outputHandler
- the handler for any stdout and stderr produced by the script.args
- the command line args to pass to the script.java.io.IOException
- if there was a problem running the process.java.lang.InterruptedException
- if the thread is interrupted while waiting for the process to finish.public java.util.Map<java.lang.String,java.lang.String> environment()
ProcessBuilder.environment()
, but this map starts empty.