(pid: number, signal: NodeJS.Signals)
| 54 | } |
| 55 | |
| 56 | function signalDaemonPid(pid: number, signal: NodeJS.Signals): boolean { |
| 57 | try { |
| 58 | process.kill(pid, signal); |
| 59 | return true; |
| 60 | } catch (error) { |
| 61 | if ((error as NodeJS.ErrnoException).code === 'ESRCH') { |
| 62 | return false; |
| 63 | } |
| 64 | const message = error instanceof Error ? error.message : String(error); |
| 65 | throw new Error(`Failed to send ${signal} to daemon PID ${pid}: ${message}`); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Get the path to the daemon executable. |