/** * @param {number} pid process id. Required. * @param {Function} killFn optional kill function, defaults to process.kill * @returns boolean true if the given process id is in the local process * table. The PID may be paused or a zombie, though. */ export declare function pidExists(pid: number | undefined, killFn?: (pid: number, signal?: string | number) => boolean): boolean; export type KillFn = (pid: number, signal?: string | number) => boolean; /** * Send a signal to the given process id. * * @param pid the process id. Required. * @param force if true, and the current user has * permissions to send the signal, the pid will be forced to shut down. Defaults to false. * @param killFn optional kill function, defaults to process.kill * @returns true if the signal was delivered. */ export declare function kill(pid: number | undefined, force?: boolean, killFn?: KillFn): boolean; /** * Send a signal to the process group led by the given process id, falling back * to the process itself. * * This is for children spawned with `detached: true`, which makes each child * the leader of its own process group: signalling the group also stops any * grandchildren the child spawned. * * It is safe for non-detached children too. A process group's id is its * leader's pid, so `-pid` names a group only when this child leads one; for a * non-detached child no such group exists and the OS reports ESRCH. (It cannot * signal *this* process's group by accident: that group is named by its own * leader's pid, which is alive and so can't have been reassigned to a child.) * Since a silent no-op here would leak the child we were asked to kill, we then * signal the pid directly -- and if the child is simply already gone, that's * another harmless ESRCH. * * Windows has no POSIX process groups, so there this behaves like {@link kill}. * * @param pid the process group leader's id (a positive pid). Required. * @param force if true, SIGKILL rather than SIGTERM. Defaults to false. * @param killFn optional kill function, defaults to process.kill */ export declare function killGroup(pid: number | undefined, force?: boolean, killFn?: KillFn): boolean; /** * Signal only the POSIX process group led by `pid`. * * Unlike {@link killGroup}, this never falls back to the direct pid. It is * used after a detached group leader has exited: the group can still contain * grandchildren, but falling back to the now-dead leader pid could signal an * unrelated process if that pid were reused. Windows has no equivalent * process-group signal, so this returns false there. */ export declare function killGroupOnly(pid: number | undefined, force?: boolean, killFn?: KillFn): boolean; /** * @return the kill function implied by the given options: signalling the whole * process group is opt-in, and only valid for `detached` children. */ export declare function killerFor(opts: { killProcessGroup: boolean; }): typeof kill;