processAlive

tcmts.cli.mcp.processAlive · #xnwic2vo · term · runs on the server

uses process

Whether a process is running (one that can't be signalled, another user's, is).

export function processAlive(pid: number): boolean {
  if (!(pid > 0)) return false;
  try {
    process.kill(pid, 0);
    return true;
  } catch (e) {
    return (e as NodeJS.ErrnoException).code === "EPERM";
  }
}

used by