(pid: number)
| 369 | } |
| 370 | |
| 371 | async function stopProcess(pid: number): Promise<void> { |
| 372 | if (!pid || !isProcessAlive(pid)) return; |
| 373 | try { |
| 374 | process.kill(pid, 'SIGTERM'); |
| 375 | } catch { |
| 376 | return; |
| 377 | } |
| 378 | if (await waitForProcessExit(pid, 1_500)) return; |
| 379 | try { |
| 380 | process.kill(pid, 'SIGKILL'); |
| 381 | } catch { |
| 382 | return; |
| 383 | } |
| 384 | await waitForProcessExit(pid, 1_500); |
| 385 | } |
no test coverage detected