/** * Best-effort process inspection for stop/start (Issue #3087) * * - Zombies: `kill(pid, 0)` succeeds for a zombie, so without an init process * (a container whose PID 1 never reaps) a stopped server's group looked alive * forever. On Linux, /proc tells a zombie apart; elsewhere nothing is known * and callers keep their signal-based answer. * - Listeners: when something answers on the configured port but is not the * server the PID file describes, the user is told which PID holds it. * * Every function here is read-only and never throws. * * @module process-inspect */ interface ProcStat { state: string; pgrp: number; } /** * Parse `/proc//stat`. The command name is parenthesised and may itself * contain spaces or parentheses, so fields are read after the LAST `)`. */ export declare function parseProcStat(content: string): ProcStat | null; /** * @returns true when /proc reports the process as a zombie (or dead); false when it is * running, absent, or the platform has no /proc */ export declare function isZombieProcess(pid: number): boolean; /** * States of every process whose process group is `pgid`. * * @returns the state letters (possibly empty), or null when /proc cannot be read * (non-Linux), in which case nothing is known */ export declare function listProcessGroupStates(pgid: number): string[] | null; /** @returns true when a /proc state letter means the process no longer runs */ export declare function isExitedState(state: string): boolean; /** * PIDs listening on a TCP port: /proc on Linux, `lsof` elsewhere. * * @returns the PIDs found; empty when none are visible (another user's process, or no tool) */ export declare function findListeningPids(port: number): number[]; /** * One-line description of a process for an error message. * * @returns the command line, or null when it cannot be read */ export declare function describeProcess(pid: number): string | null; /** * "PID 875 (node dist/server/server.js), PID 876" — or null when no PID is visible. */ export declare function describeListeners(port: number): string | null; export {}; //# sourceMappingURL=process-inspect.d.ts.map