()
| 73 | |
| 74 | let sigintHandlerCalled = false; |
| 75 | function sigintHandler() { |
| 76 | const exitWithCode130 = () => { |
| 77 | // Give tests a chance to see that launched process did exit and dispatch any async calls. |
| 78 | if (isUnderTest()) { |
| 79 | // eslint-disable-next-line no-restricted-properties |
| 80 | setTimeout(() => process.exit(130), 1000); |
| 81 | } else { |
| 82 | // eslint-disable-next-line no-restricted-properties |
| 83 | process.exit(130); |
| 84 | } |
| 85 | }; |
| 86 | |
| 87 | if (sigintHandlerCalled) { |
| 88 | // Resort to default handler from this point on, just in case we hang/stall. |
| 89 | process.off('SIGINT', sigintHandler); |
| 90 | |
| 91 | // Upon second Ctrl+C, immediately kill browsers and exit. |
| 92 | // This prevents hanging in the case where closing the browser takes a lot of time or is buggy. |
| 93 | for (const kill of killSet) |
| 94 | kill(); |
| 95 | exitWithCode130(); |
| 96 | } else { |
| 97 | sigintHandlerCalled = true; |
| 98 | gracefullyCloseAll().then(() => exitWithCode130()); |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | function sigtermHandler() { |
| 103 | gracefullyCloseAll(); |
nothing calls this directly
no test coverage detected
searching dependent graphs…