Class ExternalProcess.Builder

java.lang.Object
org.openqa.selenium.os.ExternalProcess.Builder
Enclosing class:
ExternalProcess

public static class ExternalProcess.Builder extends Object
  • Method Details

    • command

      public ExternalProcess.Builder command(String executable, List<String> arguments)
      Set the executable command to start the process, this consists of the executable and the arguments.
      Parameters:
      executable - the executable to build the command
      arguments - the arguments to build the command
      Returns:
      this instance to continue building
    • command

      public ExternalProcess.Builder command(List<String> command)
      Set the executable command to start the process, this consists of the executable and the arguments.
      Parameters:
      command - the executable, followed by the arguments
      Returns:
      this instance to continue building
    • command

      public ExternalProcess.Builder command(String... command)
      Set the executable command to start the process, this consists of the executable and the arguments.
      Parameters:
      command - the executable, followed by the arguments
      Returns:
      this instance to continue building
    • command

      public List<String> command()
      Get the executable command to start the process, this consists of the binary and the arguments.
      Returns:
      an editable list, changes to it will update the command executed.
    • environment

      public ExternalProcess.Builder environment(String name, String value)
      Set one environment variable of the process to start, will replace the old value if exists.
      Returns:
      this instance to continue building
    • environment

      public Map<String,String> environment()
      Get the environment variables of the process to start.
      Returns:
      an editable map, changes to it will update the environment variables of the command executed.
    • directory

      public File directory()
      Get the working directory of the process to start, maybe null.
      Returns:
      the working directory
    • directory

      public ExternalProcess.Builder directory(String directory)
      Set the working directory of the process to start.
      Parameters:
      directory - the path to the directory
      Returns:
      this instance to continue building
    • directory

      public ExternalProcess.Builder directory(File directory)
      Set the working directory of the process to start.
      Parameters:
      directory - the path to the directory
      Returns:
      this instance to continue building
    • copyOutputTo

      public ExternalProcess.Builder copyOutputTo(OutputStream stream)
      Where to copy the combined stdout and stderr output to, OsProcess#getOutput is still working when called.
      Parameters:
      stream - where to copy the combined output to
      Returns:
      this instance to continue building
    • bufferSize

      public ExternalProcess.Builder bufferSize(int toKeep)
      The number of bytes to buffer for OsProcess#getOutput calls.
      Parameters:
      toKeep - the number of bytes, default is 4096
      Returns:
      this instance to continue building
    • start

      public ExternalProcess start() throws UncheckedIOException
      Throws:
      UncheckedIOException