parseWMICLine static method

  1. @visibleForTesting
({String exe, int parentPid, int processPid}) parseWMICLine(
  1. String process
)

Implementation

@visibleForTesting
static ({String exe, int parentPid, int processPid}) parseWMICLine(
    String process) {
  final parts = process.split(' ');
  // we have to deal with files that contain spaces in their name.
  final exe = parts.sublist(0, parts.length - 2).join(' ');
  final parentPid = int.tryParse(parts[parts.length - 2]) ?? -1;
  final processPid = int.tryParse(parts[parts.length - 1]) ?? -1;

  return (exe: exe, parentPid: parentPid, processPid: processPid);
}