Signal handling improvements by rhansen · Pull Request #329 · andywer/threads.js

@rhansen mentioned this pull request

Dec 21, 2020

CMCDragonkai

@rhansen

The default signal handler always exits non-zero so the signal
listener installed by threads.js should too.
This also suppresses any synchronous exceptions thrown by
`worker.terminate()`.
The promise returned from `Promise.all()` immediately rejects if any
of the underlying promises reject, even if some of the other promises
have not yet settled. Catch each rejection to give the other promises
an opportunity to resolve.

`Promise.allSettled()` could be used instead, but that's a relatively
new function that was added in Node.js v12.9.0.

@rhansen