Package com.yahoo.system.execution
Class ProcessExecutor
- java.lang.Object
-
- com.yahoo.system.execution.ProcessExecutor
-
public class ProcessExecutor extends java.lang.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 java.util.Optional<ProcessResult>
execute(java.lang.String command)
Convenience method to execute a process with no input data.java.util.Optional<ProcessResult>
execute(java.lang.String command, java.lang.String processInput)
Executes the given command synchronously.
-
-
-
Method Detail
-
execute
public java.util.Optional<ProcessResult> execute(java.lang.String command) throws java.io.IOException
Convenience method to execute a process with no input data. Seeexecute(String, String)
for details.- Throws:
java.io.IOException
-
execute
public java.util.Optional<ProcessResult> execute(java.lang.String command, java.lang.String processInput) throws java.io.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:
java.io.IOException
- if the process execution failed.
-
-