예제 #1
0
 /** Append error message */
 protected void addError(String errMsg) {
   if (errMsg != null) {
     if (error == null) error = "";
     error += errMsg;
     if (task != null) task.setErrorMsg(error);
   }
 }
예제 #2
0
 /** Finished executing a command, update states, notify */
 protected void execDone() {
   stateDone();
   if (task != null) {
     task.setExitValue(exitValue);
     if (notifyTaskState != null)
       notifyTaskState.taskFinished(task, null); // Notify end of execution
   }
 }
예제 #3
0
  /** Kill a process */
  public void kill() {
    if (debug) log("Process killed");

    killCmd();

    // Notify end of execution
    if (task != null) {
      task.setExitValue(Task.EXITCODE_KILLED);
      if (notifyTaskState != null) notifyTaskState.taskFinished(task, TaskState.KILLED);
    }
  }
예제 #4
0
  /** Error while trying to 'exec' of a command, update states */
  protected void execError(Throwable t, TaskState taskState, int exitCode) {
    stateDone();
    exitValue = exitCode;

    addError(t != null ? t.getMessage() : null);

    if (debug && t != null) t.printStackTrace();

    if (task != null) {
      task.setExitValue(exitCode);
      if (notifyTaskState != null) notifyTaskState.taskFinished(task, taskState);
    }
  }