-
-
Notifications
You must be signed in to change notification settings - Fork 13
Description
I'd like to suggest that instead of calling process.exit(), we throw an Error.
As described in node's documentation for process.exit(), using this method is problematic because it disrupts all asynchronous work in progress. The documentation recommends using an error instead:
If it is necessary to terminate the Node.js process due to an error condition, throwing an uncaught error and allowing the process to terminate accordingly is safer than calling
process.exit().
One concern with making this change would be preserving the functionality of opts.exitCode. I believe we can set process.exitCode right before throwing the error, and it should preserve the intended behavior.
If the maintainers are happy with this idea, I can contribute the change in a PR.