How to exit in Deno passing a status code?
In Node.js you could use process.exit()
, what is its Deno's counterpart ?
The process. exit() method is used to end the process which is running at the same time with an exit code in NodeJS. Syntax: process.exit( code ) Parameter: This function accepts single parameter as mentioned above and described below: Code: It can be either 0 or 1.
exit() (TypeScript) Calling process. exit() will force the process to exit as quickly as possible even if there are still asynchronous operations pending that have not yet completed fully, including I/O operations to process.
Node normally exits with code 0 when no more async operations are pending. process. exit(1) should be used to exit with a failure code.
As of Deno version 0.3.4
:
Deno.exit(1); // the exit code is optional and defaults to 0
Check out https://deno.land/typedoc/ to know everything that you can access through the Deno
global.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With