Class ShellExecutor
java.lang.Object
org.nuxeo.ecm.platform.commandline.executor.service.executors.ShellExecutor
- All Implemented Interfaces:
Executor
Default implementation of the
Executor
interface. Use simple shell exec.-
Field Summary
Modifier and TypeFieldDescriptionprotected static final Pattern
Used to split the contributed command, NOT the passed parameter values.static final int
protected static final AtomicInteger
protected final boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ProcessBuilder
createProcessBuilder
(List<String> command, EnvironmentDescriptor env) 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) protected io.opencensus.common.Scope
getScopedSpan
(String name, String command) protected int
getTimeout
(CommandLineDescriptor cmdDesc) static Thread
pipe
(InputStream in, OutputStream out) Deprecated.since 11.1, seems unusedreplaceParams
(String word, CmdParameters params) Expands parameter strings in a parameter word.
-
Field Details
-
PIPE_COUNT
-
COMMAND_SPLIT
Used to split the contributed command, NOT the passed parameter values. -
useTimeout
protected final boolean useTimeout -
DEFAULT_TIMEOUT_S
public static final int DEFAULT_TIMEOUT_S- See Also:
-
-
Constructor Details
-
ShellExecutor
public ShellExecutor(boolean useTimeout)
-
-
Method Details
-
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.The execution duration is time boxed by the lower value of the command description timeout or the transaction TTL, the TTL must be greater than 5s to avoid transaction timeout.
-
getScopedSpan
-
exec1
protected ExecResult exec1(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env) throws IOException - Throws:
IOException
-
getTimeout
- Throws:
TimeoutException
-
createProcessBuilder
-
getReturnCode
-
pipe
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
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
Returns the absolute path of a command looked up on the PATH or the initial string if not found.- Since:
- 7.10
-