()
| 140 | } |
| 141 | |
| 142 | const terminateWorkersAndMaster = () => { |
| 143 | // we should terminate all workers and then gracefully shutdown self process |
| 144 | Promise.all(allWorkers.map(worker => worker.terminate())).then( |
| 145 | () => process.exit(0), |
| 146 | () => process.exit(1), |
| 147 | ) |
| 148 | allWorkers = [] |
| 149 | } |
| 150 | |
| 151 | // Take care to not leave orphaned processes behind. See #147. |
| 152 | process.on("SIGINT", () => terminateWorkersAndMaster()) |
no test coverage detected