public class ProcessTool extends ShellAbstractTool implements ShellTool
ShellTool
which runs locally.Modifier and Type | Field and Description |
---|---|
static ConfigKey<java.lang.String> |
PROP_DIRECTORY |
static ConfigKey<java.lang.Boolean> |
PROP_LOGIN_SHELL |
PROP_DIRECT_HEADER, PROP_ERR_STREAM, PROP_EXEC_ASYNC, PROP_EXEC_ASYNC_POLLING_TIMEOUT, PROP_EXEC_TIMEOUT, PROP_LOCAL_TEMP_DIR, PROP_NO_DELETE_SCRIPT, PROP_NO_EXTRA_OUTPUT, PROP_OUT_STREAM, PROP_RUN_AS_ROOT, PROP_SCRIPT_DIR, PROP_SCRIPT_HEADER, PROP_SEPARATOR, PROP_SUMMARY
Constructor and Description |
---|
ProcessTool() |
ProcessTool(java.util.Map<java.lang.String,?> flags) |
Modifier and Type | Method and Description |
---|---|
int |
execCommands(java.util.Map<java.lang.String,?> props,
java.util.List<java.lang.String> commands,
java.util.Map<java.lang.String,?> env)
Executes the set of commands using ssh exec.
|
static int |
execProcesses(java.util.List<java.lang.String> cmds,
java.util.Map<java.lang.String,?> env,
java.io.File directory,
java.io.OutputStream out,
java.io.OutputStream err,
java.lang.String separator,
boolean asLoginShell,
java.lang.Object contextForLogging)
executes a set of commands by sending them as a single process to `bash -c`
(single command argument of all the commands, joined with separator)
|
static int |
execProcesses(java.util.List<java.lang.String> cmds,
java.util.Map<java.lang.String,?> env,
java.io.OutputStream out,
java.io.OutputStream err,
java.lang.String separator,
boolean asLoginShell,
java.lang.Object contextForLogging)
Deprecated.
|
static int |
execProcesses(java.util.List<java.lang.String> cmds,
java.util.Map<java.lang.String,?> env,
java.io.OutputStream out,
java.io.OutputStream err,
java.lang.String separator,
java.lang.Object contextForLogging)
Deprecated.
|
int |
execScript(java.util.Map<java.lang.String,?> props,
java.util.List<java.lang.String> commands,
java.util.Map<java.lang.String,?> env)
Executes the set of commands in a shell script.
|
static int |
execSingleProcess(java.util.List<java.lang.String> cmdWords,
java.util.Map<java.lang.String,?> env,
java.io.File directory,
java.io.OutputStream out,
java.io.OutputStream err,
java.lang.Object contextForLogging)
executes a single process made up of the given command words (*not* bash escaped);
should be portable across OS's
|
static int |
execSingleProcess(java.util.List<java.lang.String> cmdWords,
java.util.Map<java.lang.String,?> env,
java.io.OutputStream out,
java.io.OutputStream err,
java.lang.Object contextForLogging)
Deprecated.
|
execCommands, execScript, getOptionalVal
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
execCommands, execScript
public static final ConfigKey<java.lang.Boolean> PROP_LOGIN_SHELL
public static final ConfigKey<java.lang.String> PROP_DIRECTORY
public ProcessTool()
public ProcessTool(java.util.Map<java.lang.String,?> flags)
public int execScript(java.util.Map<java.lang.String,?> props, java.util.List<java.lang.String> commands, java.util.Map<java.lang.String,?> env)
ShellTool
Optional properties are the same common ones as for ShellTool.execCommands(Map, List, Map)
with the addition of:
execScript
in interface ShellTool
public int execCommands(java.util.Map<java.lang.String,?> props, java.util.List<java.lang.String> commands, java.util.Map<java.lang.String,?> env)
ShellTool
ShellTool.execScript(Map, List, Map)
),
but is not suitable if you need env values which are only set on a fully-fledged shell,
or if you want the entire block executed with root permission.
Common optional properties (which also apply to ShellTool.execScript(Map, List, Map)
) are:
ShellTool.PROP_OUT_STREAM
ShellTool.PROP_ERR_STREAM
ShellTool.PROP_SEPARATOR
(for some modes)
ShellTool.PROP_NO_EXTRA_OUTPUT
(often there is no extra output here)
ShellTool.PROP_RUN_AS_ROOT
is not typically supported here. Prefer ShellTool.execScript(Map, List, Map)
).execCommands
in interface ShellTool
@Deprecated public static int execProcesses(java.util.List<java.lang.String> cmds, java.util.Map<java.lang.String,?> env, java.io.OutputStream out, java.io.OutputStream err, java.lang.String separator, java.lang.Object contextForLogging)
execProcesses(List, Map, File, OutputStream, OutputStream, String, boolean, Object)
execProcesses(List, Map, OutputStream, OutputStream, String, boolean, Object)
but not using a login shell@Deprecated public static int execProcesses(java.util.List<java.lang.String> cmds, java.util.Map<java.lang.String,?> env, java.io.OutputStream out, java.io.OutputStream err, java.lang.String separator, boolean asLoginShell, java.lang.Object contextForLogging)
execProcesses(List, Map, File, OutputStream, OutputStream, String, boolean, Object)
public static int execProcesses(java.util.List<java.lang.String> cmds, java.util.Map<java.lang.String,?> env, java.io.File directory, java.io.OutputStream out, java.io.OutputStream err, java.lang.String separator, boolean asLoginShell, java.lang.Object contextForLogging)
consequence of this is that you should not normally need to escape things oddly in your commands, type them just as you would into a bash shell (if you find exceptions please note them here!)
@Deprecated public static int execSingleProcess(java.util.List<java.lang.String> cmdWords, java.util.Map<java.lang.String,?> env, java.io.OutputStream out, java.io.OutputStream err, java.lang.Object contextForLogging)
execSingleProcess(List, Map, File, OutputStream, OutputStream, Object)
public static int execSingleProcess(java.util.List<java.lang.String> cmdWords, java.util.Map<java.lang.String,?> env, java.io.File directory, java.io.OutputStream out, java.io.OutputStream err, java.lang.Object contextForLogging)