/** Append error message */ protected void addError(String errMsg) { if (errMsg != null) { if (error == null) error = ""; error += errMsg; if (task != null) task.setErrorMsg(error); } }
/** 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 } }
/** 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); } }
/** 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); } }