(code: number, onExit?: () => Promise<void>)
| 56 | } |
| 57 | |
| 58 | export function gracefullyProcessExitDoNotHang(code: number, onExit?: () => Promise<void>) { |
| 59 | // Force exit after 30 seconds. |
| 60 | const beforeExit = onExit ? () => onExit().catch(() => {}) : () => Promise.resolve(); |
| 61 | // eslint-disable-next-line no-restricted-properties |
| 62 | const callback = () => beforeExit().then(() => process.exit(code)); |
| 63 | |
| 64 | setTimeout(callback, 30000); |
| 65 | // Meanwhile, try to gracefully close all browsers. |
| 66 | gracefullyCloseAll().then(callback); |
| 67 | } |
| 68 | |
| 69 | function exitHandler() { |
| 70 | for (const kill of killSet) |
no test coverage detected
searching dependent graphs…