breautek commented on PR #694: URL: https://github.com/apache/cordova-cli/pull/694#issuecomment-4181157229
> bin/cordova: The .catch() handler sets process.exitCode but never calls process.exit(), so Node exits with 0 before the exit code takes effect. Added an explicit process.exit(exitCode) call. This doesn't really make sense. [process.exit](https://nodejs.org/api/process.html#processexitcode) is a forceful synchronous exit. It will not wait for pending asynchronous tasks including stdio writes. The more "proper" way to exit node is to set `exitCode` and let the nodejs process exit gracefully, including any open streams and waiting for open async handlers to run their completion, and a graceful exit will use `process.exitCode` as it's exit code. > In most situations, it is not actually necessary to call process.exit() explicitly. The Node.js process will exit on its own if there is no additional work pending in the event loop. The process.exitCode property can be set to tell the process which exit code to use when the process exits gracefully. So introducing `process.exit` here makes me worry about closing the process prematurely. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
