terminus
terminus copied to clipboard
Question: Why using process.kill instead of process.exit?
https://github.com/godaddy/terminus/blob/16f14b4b44c404209a9d5028ea586cdefde4cb05/lib/terminus.js#L116
After all handlers have been called, process.kill
is called instead of process.exit
.
Is it to avoid that Node.JS exit handlers are called?
excellent question, but I don't remember why we did it this way 😬
@silasbw does it ring a bell to you?
@axelrindle it seems like we can't answer this question :/ I'll leave it open in case anyone has any insights. But let's not change it till we don't know exactly why we did it this way
I also find it strange that process.kill
is used. Do you see any potential issues invoking process.exit(0)
in the onShutdown method in a local implementation?
I currently investigate why my instance is exited with code 137 but I suspect that is my fault and Docker-setup, but process.exit(0)
in onShutdown would solve my issue with a clean exit.
A bit late, but I'm pretty sure the reason terminus uses process.kill
can be traced back to the discussion in #1 (and here's the corresponding PR: #3)
In my case I'm specifically looking for confirmation that my process exited cleanly, and adding a process.exit(0)
to my onShutdown
achieves this.