Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exit in Deno? (analog of process.exit)

How to exit in Deno passing a status code?

In Node.js you could use process.exit(), what is its Deno's counterpart ?

like image 967
Francesco Borzi Avatar asked Oct 28 '18 10:10

Francesco Borzi


People also ask

What is process exit?

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.

How do I exit a TypeScript process?

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.

Which of the following is an exit code of node JS?

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.


1 Answers

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.

like image 65
Francesco Borzi Avatar answered Sep 29 '22 08:09

Francesco Borzi