throw new CommandLineTimeOutException( "Error while executing external command, process killed.", ex );
@Override protected void executeCommand(Command command) { try { Commandline commandLine = new Commandline(); commandLine.setExecutable(command.getExecutable()); commandLine.setWorkingDirectory(command.getWorkingDir()); for (String arg : command.getArgEntriesAsList()) { commandLine.createArg().setLine(arg); } StringStreamConsumer outConsumer = new StringStreamConsumer(); StringStreamConsumer errConsumer = new StringStreamConsumer(); executeCommand(commandLine, outConsumer, errConsumer, model.isVerbose()); String out = outConsumer.getOutput(); FileUtils.fileWrite(new File(command.getBuildScriptPath() + ".log"), out); if (model.isFailOnError() && ( out.contains("com.ibm.ws.scripting.ScriptingException") || out.contains("com.ibm.bsf.BSFException"))) { throw new WebSphereServiceException("Failed to execute the task, Please see the log for more details"); } String error = errConsumer.getOutput(); if (StringUtils.isNotEmpty(error)) { System.err.println(error); } } catch (CommandLineTimeOutException e) { throw new WebSphereServiceException("Failed to execute the task." + "Please ensure remote WAS or Deployment Manager is running. " + e.getMessage(), e); } catch (Exception e) { throw new WebSphereServiceException(e.getMessage(), e); } }
@Override public Integer call() throws CommandLineException { try { int exitValue = executeProcess(process, timeoutInSeconds, sleepMillis); waitForAllPumpers(stdin, stdout, stderr); validatePumpers(stdout, stderr); return exitValue; } catch (InterruptedException e) { handleInterruption(e); throw new CommandLineTimeOutException("error executing command, process killed", e); } finally { removeShutdownHook(processHook); processHook.run(); } }