Class ShellExecutor
- java.lang.Object
-
- org.nuxeo.ecm.platform.commandline.executor.service.executors.ShellExecutor
-
-
Field Summary
Fields Modifier and Type Field Description protected static Pattern
COMMAND_SPLIT
Used to split the contributed command, NOT the passed parameter values.static int
DEFAULT_TIMEOUT_S
protected static AtomicInteger
PIPE_COUNT
protected boolean
useTimeout
-
Constructor Summary
Constructors Constructor Description ShellExecutor(boolean useTimeout)
-
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)
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 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.
-
useTimeout
protected final boolean useTimeout
-
DEFAULT_TIMEOUT_S
public static final int DEFAULT_TIMEOUT_S
- See Also:
- Constant Field Values
-
-
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.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.
-
exec1
protected ExecResult exec1(CommandLineDescriptor cmdDesc, CmdParameters params, EnvironmentDescriptor env) throws IOException
- Throws:
IOException
-
getTimeout
protected int getTimeout(CommandLineDescriptor cmdDesc) throws TimeoutException
- Throws:
TimeoutException
-
createProcessBuilder
protected ProcessBuilder createProcessBuilder(List<String> command, EnvironmentDescriptor env)
-
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
-
-