Interface ShellUtils


public interface ShellUtils
Provides utilities for launching processes from the OS shell.
  • Method Details

    • dangerouslyExecute

      String dangerouslyExecute(String command)
      Executes the specified command using the default execution options. Splits each parameter on whitespace characters. If you require whitespace, consider using execute(String...).

      Warning: Avoid using this with arbitrary input. If you are accepting arbitrary input, consider using execute(String...) instead to minimize the risk of OS command injection.

      Parameters:
      command - The command and its parameters, separated by whitespace.
      Returns:
      The output produced by the command.
    • dangerouslyExecute

      String dangerouslyExecute(ExecuteOptions options, String command)
      Executes the specified command using the specified execution options. Splits each parameter on whitespace characters. If you require whitespace, consider using execute(ExecuteOptions, String...).

      Warning: Avoid using this with arbitrary input. If you are accepting arbitrary input, consider using execute(String...) instead to minimize the risk of OS command injection.

      Parameters:
      options - The options that control how the command is executed.
      command - The command and its parameters, separated by whitespace.
      Returns:
      The output produced by the command.
    • execute

      String execute(String... command)
      Executes the specified command using the default execution options.
      Parameters:
      command - The command and its parameters, specified as separate strings.
      Returns:
      The output produced by this command.
    • execute

      String execute(ExecuteOptions options, String... command)
      Executes the specified command using the specified execution options.
      Parameters:
      options - The options that control how the command is executed.
      command - The command and its parameters, specified as separate strings.
      Returns:
      The output produced by this command.