public class ProcessExecutor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ProcessExecutor.IO
The IO holder for a ProcessExecutor instance.
|
static class |
ProcessExecutor.ProcessException
Generic exception for ProcessExecutor.
|
static class |
ProcessExecutor.RunningProcess
Represents a Process that has been started and is or was running.
|
| Constructor and Description |
|---|
ProcessExecutor()
Construct a blank one.
|
ProcessExecutor(java.lang.ProcessBuilder from)
Construct from an existing ProcessBuilder.
|
| Modifier and Type | Method and Description |
|---|---|
ProcessExecutor |
addCmdArg(java.lang.String arg)
Adds a single argument to the command.
|
ProcessExecutor |
addCmdArgs(java.util.List<java.lang.String> args)
Adds a List of args to the command.
|
ProcessExecutor |
addCmdArgs(java.lang.String... args)
Adds an array of args to the command.
|
ProcessExecutor |
addEnvVar(java.lang.String key,
java.lang.String value)
Adds an EnvVar to the ProcessExecutor.
|
ProcessExecutor |
addEnvVars(java.util.Map<java.lang.String,java.lang.String> envVars)
Adds a Map of env vars to the ProcessExecutor.
|
ProcessExecutor |
addPreStartCallback(java.util.function.Consumer<ProcessExecutor> callback)
Adds a callback that will be executed just before the Process is started.
|
ProcessExecutor |
clearCallbacks()
Clears all callbacks.
|
ProcessExecutor |
clone()
Copies the ProcessExecutor.
|
java.util.List<java.lang.String> |
getCmd()
Gets an unmodifiable list of command arguments.
|
java.util.Map<java.lang.String,java.lang.String> |
getEnvVars()
Gets this ProcessExecutors env vars.
|
ProcessExecutor.IO |
getIO()
Gets the IO holder for this ProcessExecutor.
|
java.io.File |
getWorkingDir()
Gets the working directory for the ProcessExecutor.
|
ProcessExecutor |
setCmd(java.util.List<java.lang.String> args)
Sets the command to the specified List of args.
|
ProcessExecutor |
setCmd(java.lang.String... args)
Sets the command to the specified array of args.
|
ProcessExecutor |
setEnvVars(java.util.Map<java.lang.String,java.lang.String> envVars)
Sets the Env vars for the ProcessExecutor
|
ProcessExecutor |
setWorkingDir(java.io.File dir)
Sets the working directory for the ProcessExecutor.
|
ProcessExecutor.RunningProcess |
start()
Starts the process with the current state of this ProcessExecutor.
|
public ProcessExecutor()
public ProcessExecutor(java.lang.ProcessBuilder from)
from - The ProcessBuilderpublic ProcessExecutor addCmdArg(java.lang.String arg)
arg - The arg.public ProcessExecutor addCmdArgs(java.lang.String... args)
args - The args.public ProcessExecutor addCmdArgs(java.util.List<java.lang.String> args)
args - The args.public ProcessExecutor setCmd(java.lang.String... args)
args - The args.public ProcessExecutor setCmd(java.util.List<java.lang.String> args)
args - The args.public java.util.List<java.lang.String> getCmd()
public ProcessExecutor setWorkingDir(java.io.File dir)
dir - The dir.public java.io.File getWorkingDir()
public ProcessExecutor addEnvVar(java.lang.String key, java.lang.String value)
key - The key.value - The value.public ProcessExecutor addEnvVars(java.util.Map<java.lang.String,java.lang.String> envVars)
envVars - The env vars.public ProcessExecutor setEnvVars(java.util.Map<java.lang.String,java.lang.String> envVars)
envVars - The env vars.public java.util.Map<java.lang.String,java.lang.String> getEnvVars()
public ProcessExecutor addPreStartCallback(java.util.function.Consumer<ProcessExecutor> callback)
callback - The callback.public ProcessExecutor clearCallbacks()
public ProcessExecutor.IO getIO()
public ProcessExecutor.RunningProcess start() throws ProcessExecutor.ProcessException
ProcessExecutor.ProcessException - If the Process could not be started.public ProcessExecutor clone()
clone in class java.lang.Object