Interface CommandExec

All Known Implementing Classes:
DefaultCommandExec, ScriptCommandExec

public interface CommandExec
Executes an external command.
Since:
1.11
Author:
Erwin Mueller, erwin.mueller@deventm.org
  • Method Details

    • setThreads

      void setThreads(Threads threads)
      Sets the threads pool.
      Parameters:
      threads - the Threads.
    • setCommandOutput

      void setCommandOutput(CommandOutput output)
      Sets that reads the standard output of the command.
      Parameters:
      output - the CommandOutput.
    • setCommandError

      void setCommandError(CommandOutput error)
      Sets that reads the error output of the command.
      Parameters:
      error - the CommandOutput.
    • setCommandInput

      void setCommandInput(CommandInput input)
      Sets that writes to the standard input of the command.
      Parameters:
      input - the CommandInput.
    • setExitCode

      void setExitCode(int... code)
      Sets the valid command code(s).
      Parameters:
      code - the valid command code(s).
    • setDestroyOnTimeout

      void setDestroyOnTimeout(boolean flag)
      Sets to destroy the executed command on timeout.
      Parameters:
      flag - sets to true to destroy the executed command on timeout.
    • setObserver

      void setObserver(Observer... observer)
      Sets the additional observer(s) for the command task.
      Parameters:
      observer - the Observer observer(s).
    • exec

      Future<ProcessTask> exec(CommandLine commandLine, PropertyChangeListener... listeners) throws CommandExecException
      Executes the command specified by the command line.
      Parameters:
      commandLine - the DefaultCommandLine.
      listeners - the PropertyChangeListener listeners that are informed when the command finishes.
      Returns:
      the Future of ProcessTask.
      Throws:
      CommandExecException - if there was an error executing the command; if the command was not found; if the exit code of the command is not valid.