private static @Nullable List<MacProcessInfo> doParseMacOutput(@NlsSafe String output) {
    List<MacProcessInfo> result = new ArrayList<>();
    String[] lines = StringUtil.splitByLinesDontTrim(output);
    if (lines.length == 0) return null;

    @NlsSafe String header = lines[0];
    String pidString = "PID";
    int pidStart = header.indexOf(pidString);
    if (pidStart == -1) return null;

    String parentPidString = "PPID";
    int parentPidStart = header.indexOf(parentPidString, pidStart);
    if (parentPidStart == -1) return null;

    int parentPidSectionStart = pidStart + pidString.length();

    int statStart = header.indexOf("S", parentPidStart);
    if (statStart == -1) return null;

    int userStart = header.indexOf("USER", statStart);
    if (userStart == -1) return null;

    int commandStart = header.indexOf("COMM", userStart);
    if (commandStart == -1) return null;

    for (int i = 1; i < lines.length; i++) {
      String line = lines[i];

      try {
        int pid = StringUtil.parseInt(line.substring(0, parentPidSectionStart).trim(), -1);
        if (pid == -1) continue;

        int parentPid = StringUtil.parseInt(line.substring(parentPidSectionStart, statStart).trim(), -1);

        @NlsSafe String state = line.substring(statStart, userStart).trim();
        if (state.contains("Z")) continue; // zombie

        String user = line.substring(userStart, commandStart).trim();
        String commandLine = line.substring(commandStart).trim();

        result.add(new MacProcessInfo(pid, commandLine, user, state, parentPid));
      }
      catch (Exception e) {
        LOG.error("Can't parse line '" + line + "'", e);
      }
    }
    return result;
  }
private static @Nullable List<MacProcessInfo> doParseMacOutput(@NlsSafe String output)