@Override public Long call() throws Exception { Executor executor = new DefaultExecutor(); executor.setProcessDestroyer(new ShutdownHookProcessDestroyer()); ExecuteWatchdog watchDog = new ExecuteWatchdog(watchdogTimeout); executor.setWatchdog(watchDog); executor.setStreamHandler(new PumpStreamHandler(new MyLogOutputStream(handler, true), new MyLogOutputStream(handler, false))); Long exitValue; try { exitValue = new Long(executor.execute(commandline)); } catch (ExecuteException e) { exitValue = new Long(e.getExitValue()); } if (watchDog.killedProcess()) { exitValue = WATCHDOG_EXIST_VALUE; } return exitValue; }
private static ArrayList<String> getBearSettings(String bearName) throws ExecuteException, IOException { JSONArray bearList = getAvailableBears(); JSONObject bear = null; for (int i = 0; i < bearList.length(); i++) { if (bearList.getJSONObject(i).getString("name").equals(bearName)) { bear = bearList.getJSONObject(i); break; } } JSONArray nonOptionalParams = bear.getJSONObject("metadata") .getJSONArray("non_optional_params"); ArrayList<String> settings = new ArrayList<>(); for (int i = 0; i < nonOptionalParams.length(); i++) { JSONObject setting = nonOptionalParams.getJSONObject(i); String key = setting.keys().next(); String userInput = DialogUtils.getInputDialog(key, setting.getString(key)); settings.add(key + "=" + userInput); } return settings; }
@Override public Map<String,Object> handle (Task aTask) throws Exception { CommandLine cmd = new CommandLine ("mediainfo"); cmd.addArgument(aTask.getRequiredString("input")); log.debug("{}",cmd); DefaultExecutor exec = new DefaultExecutor(); File tempFile = File.createTempFile("log", null); try (PrintStream stream = new PrintStream(tempFile);) { exec.setStreamHandler(new PumpStreamHandler(stream)); exec.execute(cmd); return parse(FileUtils.readFileToString(tempFile)); } catch (ExecuteException e) { throw new ExecuteException(e.getMessage(),e.getExitValue(), new RuntimeException(FileUtils.readFileToString(tempFile))); } finally { FileUtils.deleteQuietly(tempFile); } }
@Override public Object handle(Task aTask) throws Exception { List<String> options = aTask.getList("options", String.class); CommandLine cmd = new CommandLine ("ffmpeg"); options.forEach(o->cmd.addArgument(o)); log.debug("{}",cmd); DefaultExecutor exec = new DefaultExecutor(); File tempFile = File.createTempFile("log", null); try (PrintStream stream = new PrintStream(tempFile);) { exec.setStreamHandler(new PumpStreamHandler(stream)); int exitValue = exec.execute(cmd); return exitValue!=0?FileUtils.readFileToString(tempFile):cmd.toString(); } catch (ExecuteException e) { throw new ExecuteException(e.getMessage(),e.getExitValue(), new RuntimeException(FileUtils.readFileToString(tempFile))); } finally { FileUtils.deleteQuietly(tempFile); } }
@Override public Map<String,Object> handle(Task aTask) throws Exception { CommandLine cmd = new CommandLine ("ffprobe"); cmd.addArgument("-v") .addArgument("quiet") .addArgument("-print_format") .addArgument("json") .addArgument("-show_error") .addArgument("-show_format") .addArgument("-show_streams") .addArgument(aTask.getRequiredString("input")); log.debug("{}",cmd); DefaultExecutor exec = new DefaultExecutor(); File tempFile = File.createTempFile("log", null); try (PrintStream stream = new PrintStream(tempFile);) { exec.setStreamHandler(new PumpStreamHandler(stream)); exec.execute(cmd); return parse(FileUtils.readFileToString(tempFile)); } catch (ExecuteException e) { throw new ExecuteException(e.getMessage(),e.getExitValue(), new RuntimeException(FileUtils.readFileToString(tempFile))); } finally { FileUtils.deleteQuietly(tempFile); } }
/** * Executes the given command synchronously. * * @param command The command to execute. * @param processInput Input provided to the process. * @return The result of the execution, or empty if the process does not terminate within the timeout set for this executor. * @throws IOException if the process execution failed. */ public Optional<ProcessResult> execute(String command, String processInput) throws IOException { ByteArrayOutputStream processErr = new ByteArrayOutputStream(); ByteArrayOutputStream processOut = new ByteArrayOutputStream(); DefaultExecutor executor = new DefaultExecutor(); executor.setStreamHandler(createStreamHandler(processOut, processErr, processInput)); ExecuteWatchdog watchDog = new ExecuteWatchdog(TimeUnit.SECONDS.toMillis(timeoutSeconds)); executor.setWatchdog(watchDog); executor.setExitValues(successExitCodes); int exitCode; try { exitCode = executor.execute(CommandLine.parse(command)); } catch (ExecuteException e) { exitCode = e.getExitValue(); } return (watchDog.killedProcess()) ? Optional.empty() : Optional.of(new ProcessResult(exitCode, processOut.toString(), processErr.toString())); }
protected void stopDc(DcMeta dcMeta) throws ExecuteException, IOException { for(InetSocketAddress address : IpUtils.parse(dcMeta.getZkServer().getAddress())){ logger.info(remarkableMessage("[stopZkServer]{}"), address); stopServerListeningPort(address.getPort()); } for(MetaServerMeta metaServerMeta : dcMeta.getMetaServers()){ logger.info("[stopMetaServer]{}", metaServerMeta); stopServerListeningPort(metaServerMeta.getPort()); } for (ClusterMeta clusterMeta : dcMeta.getClusters().values()) { for (ShardMeta shardMeta : clusterMeta.getShards().values()) { for (KeeperMeta keeperMeta : shardMeta.getKeepers()) { logger.info("[stopKeeperServer]{}", keeperMeta.getPort()); stopServerListeningPort(keeperMeta.getPort()); } for(RedisMeta redisMeta : shardMeta.getRedises()){ logger.info("[stopRedisServer]{}", redisMeta.getPort()); stopServerListeningPort(redisMeta.getPort()); } } } }
private String execToString(File model, File properties) throws ExecuteException, IOException { String command; String prism = (System.getProperty("os.name").contains("Windows"))? "prism.bat" : "prism"; if (mConverter.isBoundedNet()) { command = mPrismPath + " " + model.getAbsolutePath() + " " + properties.getAbsolutePath() + " -exportstates " + mFilesPath+mStatesFileName; } else { command = mPrismPath + " " + model.getAbsolutePath() + " " + properties.getAbsolutePath() + " -ex"; } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ByteArrayOutputStream errorStream = new ByteArrayOutputStream(); CommandLine commandline = CommandLine.parse(command); DefaultExecutor exec = new DefaultExecutor(); PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream, errorStream); //Workbench.consoleMessage("Executing: " + command); exec.setStreamHandler(streamHandler); System.out.println("Executing "+command); exec.execute(commandline); System.out.println("ID-Mapping: "+TransitionToIDMapper.getMapping()); return(outputStream.toString()); }
private ExecuteResultHandler asynchExecutionHandler() { return new ExecuteResultHandler() { @Override public void onProcessFailed(ExecuteException ex) { throw new RuntimeException("Engine operation failed.", ex); } @Override public void onProcessComplete(int exitValue) { context.log.info("Engine process stopped."); } }; }
public void waitForExit(CppcheckProcessResultHandler resultHandler, IProgressMonitor monitor) throws InterruptedException, ProcessExecutionException, IOException { try { while (resultHandler.isRunning()) { Thread.sleep(SLEEP_TIME_MS); if (monitor.isCanceled()) { watchdog.destroyProcess(); throw new InterruptedException("Process killed"); } } // called to throw execution in case of invalid exit code resultHandler.getExitValue(); } catch (ExecuteException e) { // we need to rethrow the error to include the command line // since the error dialog does not display nested exceptions, // include original error string throw ProcessExecutionException.newException(cmdLine.toString(), e); } finally { processStdErr.close(); processStdOut.close(); } long endTime = System.currentTimeMillis(); console.println("Duration " + String.valueOf(endTime - startTime) + " ms."); }
@Override public void onTranscodeProcessFailed(ExecuteException e, ExecuteWatchdog watchdog, long timestamp) { // TODO Auto-generated method stub String cause = null; if(watchdog != null && watchdog.killedProcess()) cause = FAILURE_BY_TIMEOUT; else cause = GENERIC_FAILURE; if(timestamp - this.resultHandler.getAbortRequestTimestamp()>ABORT_TIMEOUT) { logger.warn("onTranscodeProcessFailed cause: " + cause); notifyObservers(SessionEvent.FAILED, new TranscoderExecutionError(e, cause, timestamp)); } else { logger.warn("Probable force abort"); doCleanUp(); } }
public static ExecuteResult runOnLocalhost(ExecExceptionHandling exceptionHandling, CommandLine cmdLineOnLocalhost) throws ExecuteException, IOException { DefaultExecutor executor = new DefaultExecutor(); OutputsToStringStreamHandler streamHandler = new OutputsToStringStreamHandler(); executor.setStreamHandler(streamHandler); executor.setExitValues(null); int exitValue = executor.execute(cmdLineOnLocalhost); ExecuteResult result = new ExecuteResult(streamHandler.getStandardOutput(), streamHandler.getStandardError(), exitValue); switch (exceptionHandling) { case RETURN_EXIT_CODE_WITHOUT_THROWING_EXCEPTION: break; case THROW_EXCEPTION_IF_EXIT_CODE_NOT_0: if (exitValue != 0) { throw new ExecuteException("Failed to execute " + cmdLineOnLocalhost + " - Output: " + result, exitValue); } break; default: break; } return result; }
@Test public void testDeleteAndCopyFileHdfs() throws ExecuteException, IOException { resetTransferDirectories(SMALL_NUMBER_OF_FILES); String testFilename = getTestFilename(0); File hdfsFile = new File("/tmp/copy-file-test", testFilename); ShmackUtils.deleteInHdfs(hdfsFile); assertHdfsFileOrFolderDoesNotExist(hdfsFile); File localSrcFile = new File(LOCAL_SRC_DIR, testFilename); ShmackUtils.copyToHdfs(localSrcFile, hdfsFile); File localTargetFile = new File(LOCAL_TARGET_DIR, testFilename); ShmackUtils.copyFromHdfs(hdfsFile, localTargetFile); assertFileContentEquals(LOCAL_SRC_DIR, LOCAL_TARGET_DIR, testFilename); ShmackUtils.deleteInHdfs(hdfsFile); assertHdfsFileOrFolderDoesNotExist(hdfsFile); }
public static int run(final GeneratorConfig gc, final ExecutionConfig ec) throws IOException, InterruptedException { final File configFile = File.createTempFile("trainbenchmark-generator-", ".conf"); final String configPath = configFile.getAbsolutePath(); gc.saveToFile(configPath); final String projectName = String.format("trainbenchmark-generator-%s", gc.getProjectName()); final String jarPath = String.format("../%s/build/libs/%s-1.0.0-SNAPSHOT-fat.jar", projectName, projectName); final String javaCommand = String.format("java -Xms%s -Xmx%s -server -jar %s %s", ec.getXms(), ec.getXmx(), jarPath, configPath); final CommandLine cmdLine = CommandLine.parse(javaCommand); final DefaultExecutor executor = new DefaultExecutor(); try { final int exitValue = executor.execute(cmdLine); System.out.println(); return exitValue; } catch (final ExecuteException e) { e.printStackTrace(System.out); return e.getExitValue(); } }
@Test public void onProcessFailedShouldWrapCause() throws Exception { // Arrange ProcessHandler mockProcessHandler = mock(ProcessHandler.class); ForwardingExecuteResultHandler target = new ForwardingExecuteResultHandler(mockProcessHandler); ExecuteException expectedCause = new ExecuteException("foo", -123); // Act target.onProcessFailed(expectedCause); // Assert ArgumentCaptor<ProcessException> captor = captorForClass(ProcessException.class); verify(mockProcessHandler).onProcessFailed(captor.capture()); Throwable cause = captor.getValue().getCause(); assertThat(cause).isEqualTo(expectedCause); }
@Test public void runWrapsInnerExceptionInErrorCase() throws Exception { // Arrange Executor mockExecutor = mock(Executor.class); ExecuteException expectedCause = new ExecuteException("foo", -1); doThrow(expectedCause).when(mockExecutor).execute(any(CommandLine.class), any(ExecuteResultHandler.class)); ProcessRunner target = new CommonsExecProcessRunner(mockExecutor, testFolder.getRoot(), new File("exe"), new String[0], new HashMap<String, File>(), 10); // Act catchException(target).run(mock(ProcessHandler.class)); Exception result = caughtException(); // Assert assertThat(result).isInstanceOf(ProcessException.class); assertThat(result.getCause()).isEqualTo(expectedCause); }
private void compactLines(List<File> tableFile, File finalTable) throws ExecuteException, IOException { Executor executor = new DefaultExecutor(); File tempTabTot = File.createTempFile("ridireTABTOT", ".tbl"); File tempSh = File.createTempFile("ridireSH", ".sh"); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("export LC_ALL=C\n"); stringBuffer.append("cat " + StringUtils.join(tableFile, " ") + " > " + tempTabTot.getAbsolutePath() + "\n"); stringBuffer .append("awk '{a[$2]+= $1; s+=$1}END{for(i in a){print a[i],i;}; print s \"\t\"}' " + tempTabTot.getAbsolutePath() + " | sort -k1nr -k2 > " + finalTable.getAbsolutePath()); FileUtils.writeStringToFile(tempSh, stringBuffer.toString()); tempSh.setExecutable(true); CommandLine commandLine = new CommandLine(tempSh.getAbsolutePath()); executor.execute(commandLine); FileUtils.deleteQuietly(tempTabTot); FileUtils.deleteQuietly(tempSh); }
private void executeCQPQuery(File queryFile, boolean inverse) throws ExecuteException, IOException { Executor executor = new DefaultExecutor(); File tempSh = File.createTempFile("ridireSH", ".sh"); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("export LC_ALL=C\n"); String corpusName = this.cqpCorpusName; if (inverse) { corpusName += "INV"; } stringBuffer.append(this.cqpExecutable + " -f " + queryFile.getAbsolutePath() + " -D " + corpusName + " -r " + this.cqpRegistry + "\n"); FileUtils.writeStringToFile(tempSh, stringBuffer.toString()); tempSh.setExecutable(true); CommandLine commandLine = new CommandLine(tempSh.getAbsolutePath()); executor.execute(commandLine); FileUtils.deleteQuietly(tempSh); }
private void executeCQPQuery(File queryFile, boolean inverse) throws ExecuteException, IOException { Executor executor = new DefaultExecutor(); File tempSh = File.createTempFile("ridireSH", ".sh"); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("LC_ALL=C && "); String corpusName = this.cqpCorpusName; if (inverse) { corpusName += "INV"; } stringBuffer.append(this.cqpExecutable + " -f " + queryFile.getAbsolutePath() + " -D " + corpusName + " -r " + this.cqpRegistry + "\n"); FileUtils.writeStringToFile(tempSh, stringBuffer.toString()); tempSh.setExecutable(true); CommandLine commandLine = new CommandLine(tempSh.getAbsolutePath()); executor.execute(commandLine); FileUtils.deleteQuietly(tempSh); }
private Integer getCQPQueryResultsSize(File queryFile) throws ExecuteException, IOException { Executor executor = new DefaultExecutor(); File tempSh = File.createTempFile("ridireSH", ".sh"); File tempSize = File.createTempFile("ridireSZ", ".size"); StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("export LC_ALL=C\n"); stringBuffer.append(this.cqpExecutable + " -f " + queryFile.getAbsolutePath() + " -D " + this.cqpCorpusName + " -r " + this.cqpRegistry + " > " + tempSize.getAbsolutePath() + "\n"); FileUtils.writeStringToFile(tempSh, stringBuffer.toString()); tempSh.setExecutable(true); CommandLine commandLine = new CommandLine(tempSh.getAbsolutePath()); executor.execute(commandLine); Integer size = 0; List<String> lines = FileUtils.readLines(tempSize); if (lines.size() > 0) { size = Integer.parseInt(lines.get(0).trim()); } FileUtils.deleteQuietly(tempSh); FileUtils.deleteQuietly(tempSize); return size; }
/** * Creates a process and logs the output */ public void executeProcess(String[] cmd, String logKey, ProcessResult result, Map<String, String> additionalEnvVars, File workingDir) { Map<String, String> env = getEnvVars(cmd, additionalEnvVars); logger.info(format("%s Cmd: %s, Additional Env Vars: %s", logKey, String.join(" ", cmd), additionalEnvVars)); try { CommandLine cmdLine = new CommandLine(cmd[0]); // add rest of cmd string[] as arguments for (int i = 1; i < cmd.length; i++) { // needs the quote handling=false or else doesn't work // http://www.techques.com/question/1-5080109/How-to-execute--bin-sh-with-commons-exec? cmdLine.addArgument(cmd[i], false); } DefaultExecutor executor = new DefaultExecutor(); executor.setExitValue(0); executor.setWatchdog(new ExecuteWatchdog(timeoutInSeconds * 1000)); executor.setStreamHandler(new OutputHandler(logger, logKey, result)); if (workingDir != null) { executor.setWorkingDirectory(workingDir); } result.setResultCode(executor.execute(cmdLine, env)); // set fault to last error if fault map is empty if (result.getResultCode() != 0 && result.getFaultMap().keySet().size() < 1) { result.getFaultMap().put("ERROR", result.getLastError()); } } catch (ExecuteException ee) { logger.error(logKey + ee); result.setResultCode(ee.getExitValue()); } catch (IOException e) { logger.error(e); result.setResultCode(1); } }
public static void exec_command(String command) throws ExecuteException, IOException { String[] cmdlist = command.split(" "); CommandLine cmd = new CommandLine(cmdlist[0]); for (int i = 1; i < cmdlist.length; i++) { cmd.addArgument(cmdlist[i]); } DefaultExecutor exec = new DefaultExecutor(); exec.execute(cmd); }
/** * Get details of all bears that are available on the user's system. * * @return JSONArray containing details of bears. */ public static JSONArray getAvailableBears() throws ExecuteException, IOException { CommandLine cmdLine = new CommandLine("coala"); cmdLine.addArgument("--json"); cmdLine.addArgument("-B"); final ByteArrayOutputStream stdout = new ByteArrayOutputStream(); PumpStreamHandler pumpStreamHandler = new PumpStreamHandler(stdout, null); Executor executor = new DefaultExecutor(); executor.setStreamHandler(pumpStreamHandler); executor.execute(cmdLine); JSONArray bearList = new JSONObject(stdout.toString()).getJSONArray("bears"); return bearList; }
private ArrayList<String> getBears() throws ExecuteException, IOException { JSONArray bearList = ExternalUtils.getAvailableBears(); ArrayList<String> bearNames = new ArrayList<>(); for (int i = 0; i < bearList.length(); i++) { bearNames.add(bearList.getJSONObject(i).getString("name")); } Collections.reverse(bearNames); return bearNames; }
@Test public void test() throws InterruptedException, CoreException, ExecuteException, IOException { removeMarkers.removeAllMarkers(file); ExternalUtils.runBearOnFile(file, "CheckstyleBear"); sleep(60); IMarker[] markers = file.findMarkers("com.coala.core.problem", true, IResource.DEPTH_INFINITE); assertEquals(markers.length, 3); }
@Test public void test() throws ExecuteException, IOException, CoreException { IPath path = project.getLocation(); String folder = path.toOSString(); ExternalUtils.runcoafile(folder, project); sleep(60); IMarker[] markers = file.findMarkers("com.coala.core.problem", true, IResource.DEPTH_INFINITE); assertEquals(markers.length, 3); }
public static void startAppiumServer1() throws ExecuteException, IOException{ ServerArguments serverArguments = new ServerArguments(); serverArguments.setArgument("--address", Constant.SERVER1_ADDRESS); serverArguments.setArgument("-p", Constant.APPIUM_COMMON_PORT); appiumServer1 = new AppiumServer(new File(Constant.PATH_TO_NODE_DIRECTORY), new File(Constant.PATH_TO_APPIUM_JAVASCRIPT), serverArguments); appiumServer1.startServer(); }
public static void startAppiumServer2() throws ExecuteException, IOException{ ServerArguments serverArguments = new ServerArguments(); serverArguments.setArgument("-a", Constant.SERVER2_ADDRESS); serverArguments.setArgument("--webdriveragent-port", Constant.WEBDRIVERAGENT_PORT); appiumServer2 = new AppiumServer(new File(Constant.PATH_TO_NODE_DIRECTORY), new File(Constant.PATH_TO_APPIUM_JAVASCRIPT), serverArguments); appiumServer2.startServer(); }
public static void startAppiumServer1IfNecessary() throws ExecuteException, IOException{ if(null==appiumServer1){ System.out.println("Appium Server 1 is not running, let's start it."); startAppiumServer1(); }else if(!appiumServer1.isServerRunning()){ System.out.println("Restarting Appium Server 1."); startAppiumServer1(); } }
public static void startAppiumServer2IfNecessary() throws ExecuteException, IOException{ if(null==appiumServer2){ System.out.println("Appium Server 2 is not running, let's start it."); startAppiumServer2(); }else if(!appiumServer2.isServerRunning()){ System.out.println("Restarting Appium Server 2."); startAppiumServer2(); } }
protected void executeScript(String file, String... args) throws ExecuteException, IOException { URL url = getClass().getClassLoader().getResource(file); if (url == null) { url = getClass().getClassLoader().getResource("scripts/" + file); if (url == null) { throw new FileNotFoundException(file); } } DefaultExecutor executor = new DefaultExecutor(); String command = "sh -v " + url.getFile() + " " + StringUtil.join(" ", args); executor.execute(CommandLine.parse(command)); }
private void startRedises(String dc, String clusterId, String shardId) throws ExecuteException, IOException { DcMeta dcMeta = getDcMeta(dc); for(RedisMeta redisMeta : getDcMeta(dc).getClusters().get(clusterId).getShards().get(shardId).getRedises()){ startRedis(redisMeta); } }
protected void stopXippe() throws ExecuteException, IOException { stopConsole(); //stop all servers stopAllRedisServer(); // stop keeper for (DcMeta dcMeta : getXpipeMeta().getDcs().values()) { stopDc(dcMeta); } }
protected void startRedises() throws ExecuteException, IOException{ for(DcMeta dcMeta : getDcMetas()){ for(RedisMeta redisMeta : getDcRedises(dcMeta.getId(), getClusterId(), getShardId())){ startRedis(redisMeta); } } }
@Test public void testReFullSync() throws ExecuteException, IOException{ RedisKeeperServer redisKeeperServer = getRedisKeeperServerActive(dc); DefaultReplicationStore replicationStore = (DefaultReplicationStore) redisKeeperServer.getReplicationStore(); DcMeta dcMeta = getDcMeta(); RedisMeta slave1 = createSlave(activeKeeper.getIp(), activeKeeper.getPort()); int lastRdbUpdateCount = replicationStore.getRdbUpdateCount(); logger.info(remarkableMessage("[testReFullSync][sendRandomMessage]")); sendRandomMessage(redisMaster, 1, replicationStoreCommandFileSize); for(int i=0; i < 3 ; i++){ logger.info(remarkableMessage("[testReFullSync]{}"), i); startRedis(slave1); sleep(3000); int currentRdbUpdateCount = replicationStore.getRdbUpdateCount(); logger.info("[testReFullSync]{},{}", lastRdbUpdateCount, currentRdbUpdateCount); Assert.assertEquals(lastRdbUpdateCount + 1, currentRdbUpdateCount); lastRdbUpdateCount = currentRdbUpdateCount; sendMesssageToMasterAndTest(100, getRedisMaster(), Lists.newArrayList(slave1)); } }
protected int executeCommandLine( Executor exec, CommandLine commandLine, Map<String, String> enviro, OutputStream out, OutputStream err ) throws ExecuteException, IOException { // note: don't use BufferedOutputStream here since it delays the outputs MEXEC-138 PumpStreamHandler psh = new PumpStreamHandler( out, err, System.in ); return executeCommandLine( exec, commandLine, enviro, psh ); }
protected int executeCommandLine( Executor exec, CommandLine commandLine, Map<String, String> enviro, FileOutputStream outputFile ) throws ExecuteException, IOException { BufferedOutputStream bos = new BufferedOutputStream( outputFile ); PumpStreamHandler psh = new PumpStreamHandler( bos ); return executeCommandLine( exec, commandLine, enviro, psh ); }
protected int executeCommandLine( Executor exec, CommandLine commandLine, Map enviro, OutputStream out, OutputStream err ) throws IOException, ExecuteException { commandLines.add( commandLine ); if ( failureMsg != null ) { throw new ExecuteException( failureMsg, executeResult ); } return executeResult; }