PumpStreamHandler streamHandler = new PumpStreamHandler(stdout); executor.setExitValue(1); executor.setStreamHandler(streamHandler); executor.setWatchdog(watchdog);
/** * Create {@link org.apache.commons.exec.Executor} with infinite timeout watchdog * * @return created executor */ public static Executor createExecutor() { ExecuteWatchdog watchdog = new ExecuteWatchdog(INFINITE_TIMEOUT); Executor executor = new DefaultExecutor(); executor.setExitValue(1); executor.setWatchdog(watchdog); return executor; }
executor.setExitValue(0);
executor.setExitValue(0); executor.setWatchdog(watchdog); executor.setWorkingDirectory(pugTemp);
executor.setWorkingDirectory(workingDir); executor.setExitValue(0); if (dumpOutput) { LOG.info("CMD: " + command);
/** * Execute a command on the operating system using Apache Commons Exec. This * function runs asynchronously and dumps both stderr and stdout streams to * a temp file. * * @param commandLine * The command to be executed. * @param outputStreamHandler * An output stream to dump the process stderr and stdout to it. */ public static void runCommandUsingApacheExec(CommandLine commandLine, OutputStream outputStreamHandler) { try { DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); PumpStreamHandler streamHandler = new PumpStreamHandler(outputStreamHandler); logger.info("commandLine: " + commandLine.toString()); Executor process = new DefaultExecutor(); process.setExitValue(0); process.setStreamHandler(streamHandler); process.execute(commandLine, resultHandler); // resultHandler.waitFor(); } catch (Exception ex) { logger.error("An exception was thrown.", ex); } }
/** * Execute a command on the operating system using Apache Commons Exec. This * function runs asynchronously and dumps both stderr and stdout streams to * a temp file. * * @param commandLine * The command to be executed. * @param outputStreamHandler * An output stream to dump the process stderr and stdout to it. */ public static void runCommandUsingApacheExec(CommandLine commandLine, OutputStream outputStreamHandler) { try { DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler(); PumpStreamHandler streamHandler = new PumpStreamHandler(outputStreamHandler); logger.info("commandLine: " + commandLine.toString()); Executor process = new DefaultExecutor(); process.setExitValue(0); process.setStreamHandler(streamHandler); process.execute(commandLine, resultHandler); // resultHandler.waitFor(); } catch (Exception ex) { logger.error("An exception was thrown.", ex); } }
PumpStreamHandler psh = new PumpStreamHandler(stdout); Executor executor = new DefaultExecutor(); executor.setExitValue(0); executor.setStreamHandler(psh); try { killCmdLine.addArgument(app.getId()); Executor killExecutor = new DefaultExecutor(); killExecutor.setExitValue(0); try { killExecutor.execute(killCmdLine);
private static void internalExecute(CommandLine cmdLine, OutputStream outputStream, File workingDirectory) throws IOException { Executor executor = getExecutor(); ExecuteWatchdog watchdog = getExecuteWatchdog(); executor.setWatchdog(watchdog); if (workingDirectory != null) { executor.setWorkingDirectory(workingDirectory); } // set allowed exit values (0 is actually the default) executor.setExitValue(0); PumpStreamHandler psh = new PumpStreamHandler(outputStream); executor.setStreamHandler(psh); executor.execute(cmdLine); if (watchdog.killedProcess()) { throw new ExecuteException(String.format("Watchdog killed Sencha Cmd process after %s ms.", MAX_EXECUTION_TIME), 0); } }
PumpStreamHandler streamHandler = new PumpStreamHandler(stdout); executor.setExitValue(1); executor.setStreamHandler(streamHandler); executor.setWatchdog(watchdog);
executor.setExitValue(0); executor.setWatchdog(watchdog); executor.setWorkingDirectory(pugTemp);
executor.setExitValue(0); executor.setStreamHandler(psh); try {
ExecuteWatchdog watchdog = new ExecuteWatchdog(60 * 10000); Executor executor = new DefaultExecutor(); executor.setExitValue(1); executor.setWatchdog(watchdog); executor.setStreamHandler(streamHandler);