Interface PipelineBuilder<O>

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:
  • Method Details

    • arguments

      PipelineBuilder<O> arguments(List<String> command)
      Set the arguments for this process execution.
      Parameters:
      command - the arguments for this process execution (must not be null)
      Returns:
      this builder
    • arguments

      PipelineBuilder<O> arguments(String... command)
      Set the arguments for this process execution.
      Parameters:
      command - the arguments for this process execution (must not be null)
      Returns:
      this builder
    • specialQuoting

      PipelineBuilder<O> specialQuoting(boolean 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 - true to enable special quoting, or false to use default quoting
      Returns:
      this builder
    • directory

      PipelineBuilder<O> directory(Path directory)
      Set the working directory for this process execution.
      Parameters:
      directory - the working directory (must not be null)
      Returns:
      this builder
    • environment

      PipelineBuilder<O> environment(Map<String,String> newEnvironment)
      Set the environment for this process execution, overriding the inherited environment.
      Parameters:
      newEnvironment - the new environment (must not be null)
      Returns:
      this builder
    • modifyEnvironment

      PipelineBuilder<O> modifyEnvironment(Consumer<Map<String,String>> action)
      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 be null)
      Returns:
      this builder
    • output

      Configure the output handling of the process.
      Returns:
      the output configuration view of this builder (not null)
    • 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 null but may yield null)
    • exitCodeChecker

      PipelineBuilder<O> exitCodeChecker(IntPredicate checker)
      Add a failure exit code checker. The checker returns true if the process execution should fail for this exit code. If so, a ProcessException will 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 be null)
      Returns:
      this builder
    • whileRunning

      Set the while-running process handler.
      Parameters:
      action - the action to run (must not be null)
      Returns:
      this builder