Package org.eclim.util

Examples of org.eclim.util.CommandExecutor


      String nature, CommandLine commandLine)
    throws Exception
  {
    String interpreterPath = commandLine.getValue(Options.PATH_OPTION);
    String type = "ruby";
    CommandExecutor process = CommandExecutor.execute(new String[]{
      interpreterPath, "--version",
    }, 5000);

    if(process.getReturnCode() == -1){
      process.destroy();
      logger.error("ruby command timed out.");
      throw new RuntimeException("ctags command timed out.");
    }else if(process.getReturnCode() > 0){
      logger.error("ruby command error: " + process.getErrorMessage());
      throw new RuntimeException("ruby error: " + process.getErrorMessage());
    }

    if (process.getResult().indexOf("jruby") != -1){
      type = "jruby";
    }

    return DltkInterpreterTypeManager.getInterpreterInstallType(type, nature);
  }
View Full Code Here


      arguments[4] = COMMAND;
    }

    System.out.println("Command: " + StringUtils.join(arguments, ' '));

    CommandExecutor process = null;
    try{
      process = CommandExecutor.execute(arguments, timeout);
    }catch(Exception e){
      throw new RuntimeException(e);
    }

    if(process.getReturnCode() == -1){
      process.destroy();
      throw new RuntimeException("Command timed out.");
    }

    String result = process.getResult().trim();
    String error = process.getErrorMessage();
    if(process.getReturnCode() != 0){
      if (!failOnError){
        System.out.println("Result: " + result);
        if (!StringUtils.EMPTY.equals(error)){
          System.out.println("Error: " + error);
        }
        return result;
      }
      System.out.println("OUT: " + result);
      System.out.println("ERR: " + error);
      throw new RuntimeException("Command failed: " + process.getReturnCode());
    }

    System.out.println("Result: " + result);
    if (!StringUtils.EMPTY.equals(error)){
      System.out.println("Error: " + error);
View Full Code Here

            tempFile.getAbsolutePath().replace('\\', '/').replaceAll(" ", "\\ "));

        String[] cmd = {
          gvim, "-f", "-X", "-u", "NONE", "-U", "NONE", "--cmd", command};
        logger.debug(Arrays.toString(cmd));
        CommandExecutor process = CommandExecutor.execute(cmd, 5000);
        if(process.getReturnCode() != 0){
          logger.error("Failed to execute gvim: " + process.getErrorMessage());
          return false;
        }

        FileInputStream in = null;
        try{
View Full Code Here

TOP

Related Classes of org.eclim.util.CommandExecutor

Copyright © 2018 www.massapicom. 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.