mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 17:47:40 +00:00
* chore: shorten process-host comments * chore: audit CLI parsing and host-routing comments * chore: remove stale host-selector restriction comment * chore: shorten remaining CLI root comments * Shorten CLI handler comments * Shorten CLI runtime and command specification comments --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
13 lines
360 B
TypeScript
13 lines
360 B
TypeScript
export function isProcessRunning(pid: number | null | undefined): boolean {
|
|
if (!pid || pid <= 0) {
|
|
return false
|
|
}
|
|
try {
|
|
process.kill(pid, 0)
|
|
return true
|
|
} catch (error) {
|
|
// Only ESRCH proves absence; EPERM indicates a live PID under another uid.
|
|
return !(error instanceof Error && 'code' in error && error.code === 'ESRCH')
|
|
}
|
|
}
|