Class Shell.Command

java.lang.Object
fi.evolver.script.Shell.Command
Enclosing class:
Shell

public static class Shell.Command extends Object
  • Method Details

    • env

      public Shell.Command env(String variable, String value)
      Set an environment variable for the command.
      Parameters:
      variable - The variable name.
      value - The value for the variable.
      Returns:
      This command for chaining purposes.
    • stdin

      public Shell.Command stdin(InputStream data)
      Add standard input for the command.
      Parameters:
      data - Data to add to the standard input stream.
      Returns:
      This command for chaining purposes.
    • stdin

      public Shell.Command stdin(String data)
      Add standard input for the command.
      Parameters:
      data - Data to add to the standard input stream.
      Returns:
      This command for chaining purposes.
    • failOnError

      public Shell.Command failOnError(boolean value)
      Sets whether the command should fail on non-zero exit value.
      Parameters:
      value - Should the command fail on error.
      Returns:
      This command for chaining purposes.
    • workingDirectory

      public Shell.Command workingDirectory(Path path)
    • binaryStdout

      public Shell.Command binaryStdout(boolean value)
    • isSudo

      public boolean isSudo()
      Is this command run with root privileges.
      Returns:
      Whether this command uses sudo.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • user

      public static Shell.Command user(String... command)
      Create a new command run with the current user's privileges.
      Parameters:
      command - The command to run.
      Returns:
      The created command.
    • user

      public static Shell.Command user(List<String> command)
      Create a new command run with the current user's privileges.
      Parameters:
      command - The command to run.
      Returns:
      The created command.
    • sudo

      public static Shell.Command sudo(String... command)
      Create a new command run with super user privileges.
      Parameters:
      command - The command to run.
      Returns:
      The created command.
    • sudo

      public static Shell.Command sudo(List<String> command)
      Create a new command run with super user privileges.
      Parameters:
      command - The command to run.
      Returns:
      The created command.
    • run

      public Shell.Result run()
      Execute the command.
      Returns:
      The results of the command.
    • runAsync

      public Future<Shell.Result> runAsync()
      Execute the command asynchronously.
      Returns:
      The future result of the command.