Package com.yahoo.system.execution
Class ProcessExecutor
- java.lang.Object
-
- com.yahoo.system.execution.ProcessExecutor
-
public class ProcessExecutor extends Object
Configurable system command executor that captures stdout and stderr.- Author:
- gjoranv, bjorncs
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ProcessExecutor.Builder
-
Field Summary
Fields Modifier and Type Field Description int
timeoutSeconds
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<ProcessResult>
execute(String command)
Convenience method to execute a process with no input data.Optional<ProcessResult>
execute(String command, String processInput)
Executes the given command synchronously.
-
-
-
Method Detail
-
execute
public Optional<ProcessResult> execute(String command) throws IOException
Convenience method to execute a process with no input data. Seeexecute(String, String)
for details.- Throws:
IOException
-
execute
public Optional<ProcessResult> execute(String command, String processInput) throws IOException
Executes the given command synchronously.- Parameters:
command
- The command to execute.processInput
- Input provided to the process.- Returns:
- The result of the execution, or empty if the process does not terminate within the timeout set for this executor.
- Throws:
IOException
- if the process execution failed.
-
-