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

    Modifier and Type
    Method
    Description
    exec(String[] command, String[] envp, File dir)
    Executes the specified string command in a separate process with the specified environment and working directory.
  • Method Details

    • exec

      Process exec(String[] command, String[] envp, File dir) throws IOException
      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, or null if the subprocess should inherit the environment of the current process.
      dir - the working directory of the subprocess, or null 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 occurs
      NullPointerException - If command is null, or one of the elements of envp is null
      IllegalArgumentException - If command is empty
      See Also: