alive

tcmts.cli.budget.alive · #hsvqfxbt · term · runs on the server

uses process

Whether process pid is running (one of another user's counts).

export function alive(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