Interface CommandRunner
- All Known Implementing Classes:
JvmCommandRunner
public interface CommandRunner
Strategy interface for executing commands. This abstraction is useful to decouple the
command execution from the enclosing tasklet so that implementations can be unit tested
in isolation.
- Since:
- 5.0
- Author:
- Stefano Cordio, Mahmoud Ben Hassine
-
Method Summary
-
Method Details
-
exec
Executes the specified string command in a separate process with the specified environment and working directory.- Parameters:
command- a specified system command and its arguments.envp- array of strings, each element of which has environment variable settings in the format name=value, ornullif the subprocess should inherit the environment of the current process.dir- the working directory of the subprocess, ornullif the subprocess should inherit the working directory of the current process.- Returns:
- A new
Processobject for managing the subprocess - Throws:
SecurityException- If a security manager exists and itscheckExecmethod doesn't allow creation of the subprocessIOException- If an I/O error occursNullPointerException- Ifcommandisnull, or one of the elements ofenvpisnullIllegalArgumentException- Ifcommandis empty- See Also:
-