MCPcopy Index your code
hub / github.com/forloopcodes/contextplus / isProcessAlive

Function isProcessAlive

src/core/process-lifecycle.ts:66–77  ·  view source on GitHub ↗
(pid: number, killCheck: (pid: number, signal: number) => void = process.kill)

Source from the content-addressed store, hash-verified

64}
65
66export function isProcessAlive(pid: number, killCheck: (pid: number, signal: number) => void = process.kill): boolean {
67 if (!Number.isFinite(pid) || pid <= 0) return false;
68
69 try {
70 killCheck(pid, 0);
71 return true;
72 } catch (error) {
73 if (!error || typeof error !== "object") return false;
74 const { code } = error as ErrorWithCode;
75 return code !== "ESRCH";
76 }
77}
78
79export function createIdleMonitor(options: IdleMonitorOptions): IdleMonitor {
80 if (options.timeoutMs <= 0) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected