isProcessRunning static method

bool isProcessRunning(
  1. int pid
)

Static helper to check if a process is running.

Implementation

static bool isProcessRunning(int pid) {
  if (pid <= 1) return false;
  try {
    final result = Process.runSync('kill', ['-0', '$pid']);
    return result.exitCode == 0;
  } catch (_) {
    return false;
  }
}