public static long runExecutable()

in rake-runner-test/src/jetbrains/slow/plugins/rakerunner/RunCommandsHelper.java [30:62]


  public static long runExecutable(@NotNull final Logger log,
                                   @NotNull final String command,
                                   @NotNull final File workingDirectory,
                                   @Nullable Map<String, String> env,
                                   String... args) {
    final FlowLogger fl = LogUtil.getFlowLogger(log);
    final GeneralCommandLine cl = new GeneralCommandLine();
    cl.setExePath(command);
    cl.setWorkingDirectory(workingDirectory);
    cl.addParameters(args);
    cl.setEnvParams(env);
    fl.activityStarted("Run " + command, "RunExecutable");
    try {
      fl.message("Running " + command + " with " + Arrays.toString(args) + " at " + workingDirectory.getAbsolutePath());
      Long start = System.currentTimeMillis();
      final ExecResult result = SimpleCommandLineProcessRunner.runCommand(cl, null);
      Long duration = System.currentTimeMillis() - start;
      final Throwable e = result.getException();
      if (e != null) {
        throw new RuntimeException("Failed to run " + command, e);
      }
      if (result.getExitCode() != 0) {
        fl.error(result.toString());
        throw new RuntimeException("Non zero exit code of " + command + " Actual code is " + result.getExitCode());
      } else if (log.isDebugEnabled()) {
        fl.message(result.toString());
      }
      fl.message("Successfully in " + duration + "msec " + command + " with " + Arrays.toString(args) + " at " + workingDirectory.getAbsolutePath());
      return duration;
    } finally {
      fl.activityFinished("Run " + command, "RunExecutable");
    }
  }