- Type Parameters:
O- the output type
- All Known Subinterfaces:
PipelineBuilder.Error<O>,PipelineBuilder.Output<O>,ProcessBuilder<O>,ProcessBuilder.Input<O>
public sealed interface PipelineBuilder<O>
permits PipelineBuilder.Error<O>, PipelineBuilder.Output<O>, ProcessBuilder<O>
A builder for the tail portion of a pipeline.
Normally, instances of this interface are only accessible from
ProcessBuilder.newBuilder(...).- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceThe error handling aspect of the process builder.static interfaceThe output handling aspect of the process builder. -
Method Summary
Modifier and TypeMethodDescriptionSet the arguments for this process execution.Set the arguments for this process execution.Set the working directory for this process execution.environment(Map<String, String> newEnvironment) Set the environment for this process execution, overriding the inherited environment.error()Configure the error output handling of the process.exitCodeChecker(IntPredicate checker) Add a failure exit code checker.modifyEnvironment(Consumer<Map<String, String>> action) Allow the given action to modify the environment of the subprocess.output()Configure the output handling of the process.run()Run the process or pipeline.runAsync()Run the process or pipeline asynchronously.specialQuoting(boolean specialQuoting) Enable special quoting for batch scripts on Windows.whileRunning(Consumer<WaitableProcessHandle> action) Set the while-running process handler.
-
Method Details
-
arguments
Set the arguments for this process execution.- Parameters:
command- the arguments for this process execution (must not benull)- Returns:
- this builder
-
arguments
Set the arguments for this process execution.- Parameters:
command- the arguments for this process execution (must not benull)- Returns:
- this builder
-
specialQuoting
Enable special quoting for batch scripts on Windows. Note that this requires the batch script to use a specific form of argument expansion.- Parameters:
specialQuoting-trueto enable special quoting, orfalseto use default quoting- Returns:
- this builder
-
directory
Set the working directory for this process execution.- Parameters:
directory- the working directory (must not benull)- Returns:
- this builder
-
environment
Set the environment for this process execution, overriding the inherited environment.- Parameters:
newEnvironment- the new environment (must not benull)- Returns:
- this builder
-
modifyEnvironment
Allow the given action to modify the environment of the subprocess. The action is provided a mutable map which can be arbitrarily modified for the duration of the callback. Modifying the map after the callback returns will result in undefined behavior and should not be attempted.- Parameters:
action- the action (must not benull)- Returns:
- this builder
-
output
PipelineBuilder.Output<O> output()Configure the output handling of the process.- Returns:
- the output configuration view of this builder (not
null)
-
error
PipelineBuilder.Error<O> error()Configure the error output handling of the process.- Returns:
- the error output configuration view of this builder (not
null)
-
run
O run()Run the process or pipeline.- Returns:
- the result of the execution (may be
null)
-
runAsync
CompletableFuture<O> runAsync()Run the process or pipeline asynchronously.- Returns:
- the asynchronous result (not
nullbut may yieldnull)
-
exitCodeChecker
Add a failure exit code checker. The checker returnstrueif the process execution should fail for this exit code. If so, aProcessExceptionwill be constructed and thrown. The exception will generally include some or all of the data received from the error stream of the subprocess.- Parameters:
checker- the exit code checker (must not benull)- Returns:
- this builder
-
whileRunning
Set the while-running process handler.- Parameters:
action- the action to run (must not benull)- Returns:
- this builder
-