Interface ShellUtils
public interface ShellUtils
Provides utilities for launching processes from the OS shell.
-
Method Summary
Modifier and TypeMethodDescriptiondangerouslyExecute
(ExecuteOptions options, String command) Executes the specified command using the specified execution options.dangerouslyExecute
(String command) Executes the specified command using the default execution options.execute
(ExecuteOptions options, String... command) Executes the specified command using the specified execution options.Executes the specified command using the default execution options.
-
Method Details
-
dangerouslyExecute
Executes the specified command using the default execution options. Splits each parameter on whitespace characters. If you require whitespace, consider usingexecute(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
Executes the specified command using the specified execution options. Splits each parameter on whitespace characters. If you require whitespace, consider usingexecute(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
-
execute
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.
-