Class ShellExecutor
- java.lang.Object
-
- org.nuxeo.ecm.platform.commandline.executor.service.executors.ShellExecutor
-
- All Implemented Interfaces:
Executor
public class ShellExecutor extends Object implements Executor
Default implementation of theExecutor
interface. Use simple shell exec.
-
-
Field Summary
Fields Modifier and Type Field Description protected static Pattern
COMMAND_SPLIT
Used to split the contributed command, NOT the passed parameter values.protected static AtomicInteger
PIPE_COUNT
-
Constructor Summary
Constructors Constructor Description ShellExecutor()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected ProcessBuilder
createProcessBuilder(List<String> command, EnvironmentDescriptor env)
ExecResult
exec(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env)
No exception is thrown but the returnedExecResult
contains everything about the command execution, including an optional exception.protected ExecResult
exec1(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env)
static String
getCommandAbsolutePath(String command)
Returns the absolute path of a command looked up on the PATH or the initial string if not found.protected int
getReturnCode(List<Process> processes)
static Thread
pipe(InputStream in, OutputStream out)
Deprecated.since 11.1, seems unusedstatic List<String>
replaceParams(String word, CmdParameters params)
Expands parameter strings in a parameter word.
-
-
-
Field Detail
-
PIPE_COUNT
protected static final AtomicInteger PIPE_COUNT
-
COMMAND_SPLIT
protected static final Pattern COMMAND_SPLIT
Used to split the contributed command, NOT the passed parameter values.
-
-
Constructor Detail
-
ShellExecutor
public ShellExecutor()
-
-
Method Detail
-
exec
public ExecResult exec(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env)
Description copied from interface:Executor
No exception is thrown but the returnedExecResult
contains everything about the command execution, including an optional exception.
-
exec1
protected ExecResult exec1(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env) throws IOException
- Throws:
IOException
-
createProcessBuilder
protected ProcessBuilder createProcessBuilder(List<String> command, EnvironmentDescriptor env)
-
getReturnCode
protected int getReturnCode(List<Process> processes)
-
pipe
@Deprecated(since="11.1") public static Thread pipe(InputStream in, OutputStream out)
Deprecated.since 11.1, seems unusedReturns a started daemon thread piping bytes from the InputStream to the OutputStream.The streams are both closed when the copy is finished.
- Since:
- 7.10
-
replaceParams
public static List<String> replaceParams(String word, CmdParameters params)
Expands parameter strings in a parameter word.This may return several words if the parameter value is marked as a list.
- Since:
- 7.10
-
getCommandAbsolutePath
public static String getCommandAbsolutePath(String command)
Returns the absolute path of a command looked up on the PATH or the initial string if not found.- Since:
- 7.10
-
-