@Override public Execution<ProcessResult> execute() throws ExecutionException { // here we rewrap future based execution into process based execution to get better details about execution // and ability to terminate the process this.processRef = new ProcessReference(commandBuilder.build().getProgramName()); Execution<ProcessResult> processFutureExecution = super.execute(); ProcessBasedExecution<ProcessResult> execution = new ProcessBasedExecution<ProcessResult>(processFutureExecution, processRef, commandBuilder.build().getProgramName(), allowedExitCodes); return execution; }
@Override public Execution<Process> execute() throws ExecutionException { // here we rewrap future based execution into process based execution to get better details about execution Execution<Process> processFutureExecution = super.execute(); Process process = processFutureExecution.await(); ProcessReference ref = new ProcessReference(command.getProgramName()); ref.setProcess(process); ProcessBasedExecution<Process> execution = new ProcessBasedExecution<Process>(processFutureExecution, ref, command.getProgramName(), allowedExitCodes); // register shutdown hook if (!runsAsDaemon) { execution.registerShutdownHook(); } return execution; }