isProcessAlive function

bool isProcessAlive(
  1. int pid
)

Returns true if a process with pid is currently running.

Dart has no portable "is PID alive" API, so this shells out to a platform-specific tool: kill -0 on POSIX (macOS/Linux) and tasklist on Windows. Never throws — any failure to invoke the tool is treated as "not alive".

Implementation

bool isProcessAlive(int pid) {
  return Platform.isWindows ? _isProcessAliveWindows(pid) : _isProcessAlivePosix(pid);
}