private ProcessBuilder getProcessBuilder(String scriptPath, String[] args) throws FileNotFoundException {
    if (!new File(scriptPath).exists()) {
      throw new FileNotFoundException("Script file does not exist: " + scriptPath);
    }

    List<String> command = new ArrayList<>(args.length + 1);
    command.add(scriptPath);
    command.addAll(Arrays.asList(args));

    log.debug("Building process with command {}", command);
    ProcessBuilder pb =  new ProcessBuilder(command);

    pb.environment().clear();
    pb.environment().putAll(environment);
    return pb;
  }
@param scriptPath  the path to the script file.
@param args        the command line args to pass to the script.
@return            a {@link java.lang.ProcessBuilder} for the script and args.
samza-rest/src/main/java/org/apache/samza/rest/script/ScriptRunner.java