Call to _exit still exits the process, despite registering a callback
febeling opened this issue · comments
Call to _exit still exits the process (e.g. from process.error
), despite registering a callback via exitOverride
.
What was the purpose of #1040?
Is the idea that I register a callback, but I have to throw an error from it?
Why isn't the exit skipped over if there's an override?
Commander is not set up to gracefully recover from an error that would normally call process.exit()
, it expects processing to stop. So the exitOverride
callback still has to terminate the normal program flow, usually by throwing an error but could also be by calling process.exit()
with a custom error code.
Ok. Thanks for the quick response. Fwiw, I didn't understand that from reading the docs of exitOverride.
That sets expectations clearly. Thanks for addressing the issue!