Module datarush.library
Interface CommandRunner
-
- All Known Implementing Classes:
LocalCommandRunner
,RemoteCommandRunner
public interface CommandRunner
Interface defining methods used to run an executable outside of the JVM.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
dispose()
Clean up any resources that were acquired to execute shell commands.void
initialize()
Initialization required before executing a command.int
runCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr)
Run the specified command.
-
-
-
Method Detail
-
initialize
void initialize() throws IOException
Initialization required before executing a command.- Throws:
IOException
- thrown if any errors occur
-
runCommand
int runCommand(List<String> args, InputStream stdIn, OutputStream stdOut, OutputStream stdErr) throws IOException
Run the specified command. The given input stream is passed to the command as it's standard input. The standard output and standard error are captured in the given output streams. The exit code of the command as passed by the execution shell is returned.- Parameters:
args
- list of arguments for the command line executionstdIn
- input stream used as standard instdOut
- output stream that captures standard outstdErr
- output stream that captures standard err- Returns:
- exit code of the shell command
- Throws:
IOException
- thrown if any errors occur
-
dispose
void dispose() throws IOException
Clean up any resources that were acquired to execute shell commands. This method should always be called even if any errors occur running shell commands.- Throws:
IOException
- thrown if any errors occur
-
-