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, ornull
if the subprocess should inherit the environment of the current process.dir
- the working directory of the subprocess, ornull
if the subprocess should inherit the working directory of the current process.- Returns:
- A new
Process
object for managing the subprocess - Throws:
IOException
- If an I/O error occursNullPointerException
- Ifcommand
isnull
, or one of the elements ofenvp
isnull
IllegalArgumentException
- Ifcommand
is empty- See Also:
-