Package org.apache.commons.exec

Examples of org.apache.commons.exec.DefaultExecutor.execute()


    CommandLine cmdLine = CommandLine.parse(nodeJsFile);
    cmdLine.addArgument(scriptName, false);
    cmdLine.addArguments(params, false);
    DefaultExecutor executor = new DefaultExecutor();
    try {
      return executor.execute(cmdLine) == 0;
    } catch (ExecuteException e) {
      return e.getExitValue() == 0;
    }
  }
}
View Full Code Here


    executor.setExitValue(1);
    executor.setStreamHandler(streamHandler);
    executor.setWatchdog(watchdog);

    try {
      executor.execute(cmdLine, resultHandler);
      logger.debug("executed commandLine '{}'", commandLine);
    } catch (ExecuteException e) {
      logger.error("couldn't execute commandLine '" + commandLine + "'",
          e);
    } catch (IOException e) {
View Full Code Here

            File f = new File(path);
            exec.setWorkingDirectory(f);
            exec.setStreamHandler(new PumpStreamHandler(new ByteArrayOutputStream()));
            CommandLine cmd = buildServerLaunchCmd(port);
            ExecuteResultHandler handler = null;
            exec.execute(cmd, handler);
            /* sleep 5 seconds for server to get started */
            Thread.sleep(5000);
        } catch (Exception e) {
            s_logger.debug(e);
            String cause = e.getMessage();
View Full Code Here

    executor.setExitValue(1);
    executor.setStreamHandler(streamHandler);
    executor.setWatchdog(watchdog);

    try {
      executor.execute(cmdLine, resultHandler);
      logger.debug("executed commandLine '{}'", commandLine);
    } catch (ExecuteException e) {
      logger.error("couldn't execute commandLine '" + commandLine + "'", e);
    } catch (IOException e) {
      logger.error("couldn't execute commandLine '" + commandLine + "'", e);
View Full Code Here

    for (int i = 1; i < cmdlist.length; i++) {
      cmd.addArgument(cmdlist[i]);
    }

    DefaultExecutor exec = new DefaultExecutor();
    exec.execute(cmd);
  }

  /**
   * Extra dir from the jar to destdir
   *
 
View Full Code Here

      executor.setStreamHandler(streamHandler);
    }

    try {
      if (resultHandler == null) {
        executor.execute(cmd, environment);
      } else {
        executor.execute(cmd, environment, resultHandler);
      }
    }catch(ExecuteException e) {
     
View Full Code Here

    try {
      if (resultHandler == null) {
        executor.execute(cmd, environment);
      } else {
        executor.execute(cmd, environment, resultHandler);
      }
    }catch(ExecuteException e) {
     
      // @@@@
      // failed to run command
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.