()
| 149 | |
| 150 | let shutdownStarted = false |
| 151 | function installShutdownHooks() { |
| 152 | const onSignal = (signal) => { |
| 153 | if (shutdownStarted) return |
| 154 | shutdownStarted = true |
| 155 | teardownContainer().finally(() => process.exit(signal === 'SIGINT' ? 130 : 0)) |
| 156 | } |
| 157 | process.on('SIGTERM', () => onSignal('SIGTERM')) |
| 158 | process.on('SIGINT', () => onSignal('SIGINT')) |
| 159 | process.on('beforeExit', () => { |
| 160 | if (shutdownStarted) return |
| 161 | shutdownStarted = true |
| 162 | teardownContainer().catch(() => {}) |
| 163 | }) |
| 164 | } |
| 165 | |
| 166 | let runLock = Promise.resolve() |
| 167 | async function withLock(fn) { |
no test coverage detected