Author -  Sai gowtham

How to exit the process in Node.js

In this tutorial, we are going to learn about two different ways to exit the process in node.js.

Manually exiting the process

If you want to exit the process manually from a command line, you need to use ctrl+c.

Programmatically exiting the process

If you want to exit the process from a node.js program, you can use the process.exit() method which is a global object that terminates the process synchronously.

process.exit();

The process.exit() method also accepts an exit code, if we pass 1 it exits with a failure code.

process.exit(1);

If there is no status code provided, it exits with a success code 0.

You can also use process.exitCode property, to set the exit code.

process.exitCode = 1;

This code will be used by the process, when a process exits gracefully after the all pending work is finished in the event loop or a process is exited using process.exit() method without specifying a code.

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY