Package org.apache.storm.utils
Interface ShellCommandRunner
-
- All Known Implementing Classes:
ShellCommandRunnerImpl
public interface ShellCommandRunnerContains convenience functions for running shell commands for cases that are too simple to need a fullShellUtilsimplementation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringexecCommand(String... cmd)Method to execute a shell command.StringexecCommand(Map<String,String> env, String... cmd)Method to execute a shell command.StringexecCommand(Map<String,String> env, String[] cmd, long timeout)Method to execute a shell command.StringgetTokenSeparatorRegex()Token separator regex used to parse Shell tool outputs.
-
-
-
Method Detail
-
execCommand
String execCommand(String... cmd) throws IOException
Method to execute a shell command. Covers most of the simple cases without requiring the user to implement theShellUtilsinterface.- Parameters:
cmd- shell command to execute.- Returns:
- the output of the executed command.
- Throws:
IOException
-
execCommand
String execCommand(Map<String,String> env, String[] cmd, long timeout) throws IOException
Method to execute a shell command. Covers most of the simple cases without requiring the user to implement theShellUtilsinterface.- Parameters:
env- the map of environment key=valuecmd- shell command to execute.timeout- time in milliseconds after which script should be marked timeout- Returns:
- the output of the executed command.
- Throws:
IOException
-
execCommand
String execCommand(Map<String,String> env, String... cmd) throws IOException
Method to execute a shell command. Covers most of the simple cases without requiring the user to implement theShellUtilsinterface.- Parameters:
env- the map of environment key=valuecmd- shell command to execute.- Returns:
- the output of the executed command.
- Throws:
IOException
-
getTokenSeparatorRegex
String getTokenSeparatorRegex()
Token separator regex used to parse Shell tool outputs.
-
-