private static ProcessBuilder preparePythonShellCommand(ServiceAdvisorCommandType commandType, String hostsFile, String servicesFile, String outputFile, String errorFile) {
    List<String> builderParameters = new ArrayList<String>();

    if (System.getProperty("os.name").contains("Windows")) {
      builderParameters.add("cmd");
      builderParameters.add("/c");
    } else {
      builderParameters.add("sh");
      builderParameters.add("-c");
    }

    StringBuilder commandString = new StringBuilder();
    commandString.append(PYTHON_STACK_ADVISOR_SCRIPT + " ");

    commandString.append(commandType.toString()).append(" ");
    commandString.append(hostsFile).append(" ");
    commandString.append(servicesFile).append(" ");
    commandString.append("1> ");
    commandString.append(outputFile).append(" ");
    commandString.append("2>");
    commandString.append(errorFile).append(" ");

    builderParameters.add(commandString.toString());

    LOG.info("ServiceAdvisor. Python command is: " + builderParameters.toString());

    return new ProcessBuilder(builderParameters);
  }
Generate a process to invoke a Python command for the old-style Stack Advisor.
@param commandType Command Type
@param hostsFile hosts.json file
@param servicesFile services.json file
@param outputFile output.txt
@param errorFile error.txt
@return Process that can launch.
ambari-serviceadvisor/src/main/java/org/apache/ambari/serviceadvisor/ServiceAdvisor.java