terminus icon indicating copy to clipboard operation
terminus copied to clipboard

Question: Why using process.kill instead of process.exit?

Open axelrindle opened this issue 4 years ago • 4 comments

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?

axelrindle avatar Jul 29 '20 18:07 axelrindle

excellent question, but I don't remember why we did it this way 😬

@silasbw does it ring a bell to you?

gergelyke avatar Jul 29 '20 19:07 gergelyke

@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

gergelyke avatar Jul 29 '20 20:07 gergelyke

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.

JSandmark avatar Sep 08 '21 14:09 JSandmark

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.

calvinwyoung avatar Nov 16 '21 01:11 calvinwyoung