public interface ProcessExecutor
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ProcessExecutor.LaunchedProcess
Represents a running process returned by
launchProcess(ProcessExecutorParams). |
static class |
ProcessExecutor.LaunchedProcessImpl
Wraps a
Process and exposes only its I/O streams, so callers have to pass it back to
this class. |
static class |
ProcessExecutor.Option
|
static class |
ProcessExecutor.Result
Values from the result of
launchAndExecute(ProcessExecutorParams, Set,
Optional, Optional, Optional). |
ProcessExecutor.Result launchAndExecute(ProcessExecutorParams params) throws InterruptedException, IOException
launchAndExecute(ProcessExecutorParams, Set, Optional, Optional,
Optional) with boolean values set to false and optional values set to absent.InterruptedExceptionIOExceptionProcessExecutor.Result launchAndExecute(ProcessExecutorParams params, com.google.common.collect.ImmutableMap<String,String> context) throws InterruptedException, IOException
InterruptedExceptionIOExceptionProcessExecutor.Result launchAndExecute(ProcessExecutorParams params, Set<ProcessExecutor.Option> options, Optional<String> stdin, Optional<Long> timeOutMs, Optional<java.util.function.Consumer<Process>> timeOutHandler) throws InterruptedException, IOException
params.
If options contains ProcessExecutor.Option.PRINT_STD_OUT, then the stdout of the process
will be written directly to the stdout passed to the constructor of this executor. Otherwise,
the stdout of the process will be made available via ProcessExecutor.Result.getStdout().
If options contains ProcessExecutor.Option.PRINT_STD_ERR, then the stderr of the process
will be written directly to the stderr passed to the constructor of this executor. Otherwise,
the stderr of the process will be made available via ProcessExecutor.Result.getStderr().
InterruptedExceptionIOExceptionProcessExecutor.Result launchAndExecute(ProcessExecutorParams params, com.google.common.collect.ImmutableMap<String,String> context, Set<ProcessExecutor.Option> options, Optional<String> stdin, Optional<Long> timeOutMs, Optional<java.util.function.Consumer<Process>> timeOutHandler) throws InterruptedException, IOException
InterruptedExceptionIOExceptionProcessExecutor.LaunchedProcess launchProcess(ProcessExecutorParams params) throws IOException
Process given ProcessExecutorParams.IOExceptionProcessExecutor.LaunchedProcess launchProcess(ProcessExecutorParams params, com.google.common.collect.ImmutableMap<String,String> context) throws IOException
IOExceptionvoid destroyLaunchedProcess(ProcessExecutor.LaunchedProcess launchedProcess)
launchProcess(ProcessExecutorParams).ProcessExecutor.Result waitForLaunchedProcess(ProcessExecutor.LaunchedProcess launchedProcess) throws InterruptedException
launchProcess(ProcessExecutorParams) to exit, then returns the exit code of the process.
After this method returns, the launchedProcess can no longer be passed to any
methods of this object.
InterruptedExceptionProcessExecutor.Result waitForLaunchedProcessWithTimeout(ProcessExecutor.LaunchedProcess launchedProcess, long millis, Optional<java.util.function.Consumer<Process>> timeOutHandler) throws InterruptedException
waitForLaunchedProcess(LaunchedProcess) but with a timeout in milliseconds.InterruptedExceptionProcessExecutor cloneWithOutputStreams(PrintStream stdOutStream, PrintStream stdErrStream)