private void exec()

in src/jetbrains/buildServer/clouds/local/LocalCloudInstance.java [191:214]


  private void exec(@NotNull final String... params) throws Exception {
    final GeneralCommandLine cmd = new GeneralCommandLine();
    final File workDir = new File(myBaseDir, "bin");
    cmd.setWorkDirectory(workDir.getAbsolutePath());
    final Map<String, String> env = new HashMap<String, String>(System.getenv());
    //fix Java
    env.put("JAVA_HOME", System.getProperty("java.home"));

    if (SystemInfo.isWindows) {
      cmd.setExePath("cmd.exe");
      cmd.addParameter("/c");
      cmd.addParameter(new File(workDir, "agent.bat").getAbsolutePath());
    } else {
      cmd.setExePath("/bin/sh");
      cmd.addParameter(new File(workDir, "agent.sh").getAbsolutePath());
    }
    cmd.addParameters(params);

    LOG.info("Starting agent: " + cmd.getCommandLineString());
    ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(cmd, null);
    LOG.info("Execution finished: " + execResult.getExitCode());
    LOG.info(execResult.getStdout());
    LOG.info(execResult.getStderr());
  }