UNPKG

238 BJavaScriptView Raw
1module.exports = function killWorkers(workers, timeout, signal) {
2 const killed = workers.map(worker => {
3 if (worker.kill(signal, timeout)) {
4 return worker.once('exit')
5 }
6 }).filter(p => p)
7
8 return Promise.all(killed)
9}