fix: 🐛 process.exitCode instead of calling process.exit to allow cleanup#483
fix: 🐛 process.exitCode instead of calling process.exit to allow cleanup#483pcace wants to merge 1 commit intojosdejong:masterfrom
Conversation
| worker.exit = process.exit.bind(process); | ||
| worker.exit = function (code) { | ||
| process.exitCode = code; | ||
| parentPort.postMessage('__workerpool-terminate__'); |
There was a problem hiding this comment.
I am confused on why we are seeing a message to the parent for shutdown when this message typically sent from parent to child, not child to parent. The parent message handler does not have implementations to deal with this message type.
Perhaps I am missing something, but to me this is not going to achieve the goals of providing the exit code on shutdown. Can't there be another binding for worker.exitCode like worker.exit was binded?
There was a problem hiding this comment.
Yes, I have the same question indeed, this message is only send from the main process to the worker right now.
I would expect something like:
worker.exit = function (code) {
process.exitCode = code
process.exit()
}|
Thanks for your PR @pcace, and sorry for the late reply. Two remarks:
|
|
Hi there, I am very sorry, but I am not using it anymore, so my testcase is gone. |
|
Okido, I'll close your PR. Thanks anyway for your efforts! |
closes #429
see #429
The test sometimes failed, i guess because it now takes a bit longer to finish code and exit. after using 2000 it never failed on my machine. Hope thats ok.