(
pid: number,
options: {
termTimeoutMs: number;
killTimeoutMs: number;
expectedStartTime?: string;
},
)
| 97 | } |
| 98 | |
| 99 | export async function stopProcessForTakeover( |
| 100 | pid: number, |
| 101 | options: { |
| 102 | termTimeoutMs: number; |
| 103 | killTimeoutMs: number; |
| 104 | expectedStartTime?: string; |
| 105 | }, |
| 106 | ): Promise<void> { |
| 107 | if (!isAgentDeviceDaemonProcess(pid, options.expectedStartTime)) return; |
| 108 | if (!trySignalProcess(pid, 'SIGTERM')) return; |
| 109 | if (await waitForProcessExit(pid, options.termTimeoutMs)) return; |
| 110 | if (!trySignalProcess(pid, 'SIGKILL')) return; |
| 111 | await waitForProcessExit(pid, options.killTimeoutMs); |
| 112 | } |