public class ContextualProcessExecutor extends Object implements ProcessExecutor
ProcessExecutor.LaunchedProcess, ProcessExecutor.LaunchedProcessImpl, ProcessExecutor.Option, ProcessExecutor.Result| Constructor and Description |
|---|
ContextualProcessExecutor(ProcessExecutor delegate,
com.google.common.collect.ImmutableMap<String,String> context) |
public ContextualProcessExecutor(ProcessExecutor delegate, com.google.common.collect.ImmutableMap<String,String> context)
public ProcessExecutor getDelegate()
public ProcessExecutor.LaunchedProcess launchProcess(ProcessExecutorParams params) throws IOException
ProcessExecutorProcess given ProcessExecutorParams.launchProcess in interface ProcessExecutorIOExceptionpublic ProcessExecutor.LaunchedProcess launchProcess(ProcessExecutorParams params, com.google.common.collect.ImmutableMap<String,String> context) throws IOException
launchProcess in interface ProcessExecutorIOExceptionpublic ProcessExecutor.Result launchAndExecute(ProcessExecutorParams params) throws InterruptedException, IOException
ProcessExecutorProcessExecutor.launchAndExecute(ProcessExecutorParams, Set, Optional, Optional,
Optional) with boolean values set to false and optional values set to absent.launchAndExecute in interface ProcessExecutorInterruptedExceptionIOExceptionpublic ProcessExecutor.Result launchAndExecute(ProcessExecutorParams params, com.google.common.collect.ImmutableMap<String,String> context) throws InterruptedException, IOException
launchAndExecute in interface ProcessExecutorInterruptedExceptionIOExceptionpublic ProcessExecutor.Result launchAndExecute(ProcessExecutorParams params, Set<ProcessExecutor.Option> options, Optional<String> stdin, Optional<Long> timeOutMs, Optional<java.util.function.Consumer<Process>> timeOutHandler) throws InterruptedException, IOException
ProcessExecutorparams.
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().
launchAndExecute in interface ProcessExecutorInterruptedExceptionIOExceptionpublic ProcessExecutor.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
launchAndExecute in interface ProcessExecutorInterruptedExceptionIOExceptionpublic ProcessExecutor.Result waitForLaunchedProcess(ProcessExecutor.LaunchedProcess launchedProcess) throws InterruptedException
ProcessExecutorProcessExecutor.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.
waitForLaunchedProcess in interface ProcessExecutorInterruptedExceptionpublic ProcessExecutor.Result waitForLaunchedProcessWithTimeout(ProcessExecutor.LaunchedProcess launchedProcess, long millis, Optional<java.util.function.Consumer<Process>> timeOutHandler) throws InterruptedException
ProcessExecutorProcessExecutor.waitForLaunchedProcess(LaunchedProcess) but with a timeout in milliseconds.waitForLaunchedProcessWithTimeout in interface ProcessExecutorInterruptedExceptionpublic void destroyLaunchedProcess(ProcessExecutor.LaunchedProcess launchedProcess)
ProcessExecutorProcessExecutor.launchProcess(ProcessExecutorParams).destroyLaunchedProcess in interface ProcessExecutorpublic ProcessExecutor cloneWithOutputStreams(PrintStream newStdOutStream, PrintStream newStdErrStream)
ProcessExecutorcloneWithOutputStreams in interface ProcessExecutor