Linked Questions
31 questions linked to/from How to exit in Node.js
0
votes
1
answer
516
views
Node.js as a server script [duplicate]
Possible Duplicate:
How to exit in Node.JS
I'm using node.js to import some data in the background and I'll have the script running every other day in the background using cron. I don't need it to ...
95
votes
8
answers
214k
views
"Syntax error: Illegal return statement" outside a function in JavaScript
I am getting a really weird JavaScript error when I run this code:
<script type = 'text/javascript'>
var ask = confirm(<?=json_encode($message, JSON_HEX_TAG); ?>);
if (ask == false)
{
...
94
votes
3
answers
20k
views
Node.js: inspect what's left in the event loop that's preventing the script from exiting naturally
Node.js script won't exit if there's callbacks left in the main event loop. While one could forcefully terminate the script by calling process.exit() or throwing exceptions, it is recommended to let ...
56
votes
3
answers
66k
views
What is difference between method process.exit(1) and process.exit(0) in node.js?
In node.js applications i saw usage of both these methods process.exit(1) and process.exit(0). Can anybody give me the exact answer ?
43
votes
2
answers
36k
views
How to kill all child processes on exit?
How to kill all child processes (spawned using child_process.spawn) when node.js process exit?
23
votes
3
answers
23k
views
How to keep a node.js script alive while promises are being resolved?
My script performs some asynchronous tasks using promises (with the q library). Running mocha tests works fine. However running the script from the command line does not. The node process immediately ...
21
votes
1
answer
5k
views
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 ?
5
votes
3
answers
6k
views
Port "already in use" after each server restart
Searching for help with peculiar issue. Each time I stop and restart the server, I get this message:
Jim@Jim-PC MINGW64 ~/nodeProjects/express-locallibrary-tutorial
$ npm start
> express-...
8
votes
2
answers
9k
views
Handle Node.js spawnSync errors
I'm trying to run "npm publish" from a gulp task. It works, but I want to handle any error that npm command itself throws.
If I execute this code:
var cmd = spawnSync('npm.cmd', ['publish', ...
8
votes
1
answer
18k
views
What is the default behaviour of Node.js on receiving SIGTERM?
I've been reading documentation and it's not explicitly stated whether the Node.js process immediately exits or not if no signal handler is registered. For example, are pending tasks in the poll queue ...
11
votes
3
answers
5k
views
web3 websocket connection prevents node process from exiting
I have a node js process that creates a web3 websocket connection, like so:
web3 = new Web3('ws://localhost:7545')
When the process completes (I send it a SIGTERM), it does not exit, but rather hangs ...
4
votes
1
answer
3k
views
How can I find out why nodejs isn't exiting cleanly?
Let me explain first what I mean by "exiting cleanly".
If I have a nodejs app and I do setTimeout for a really long time, or if I open a socket connection that I don't close, then when I run that app ...
3
votes
2
answers
5k
views
execute node.js without using command prompt(either winform or javascript)?
I am Totally new to Node.js, i have a node app running, but now i need to execute the node.js program without using command prompt atall. It maybe through winform app(using vb.net) or using javascript....
2
votes
1
answer
3k
views
How to prevent Knex from hanging on insert
I am using Knex.js to insert values from an array into a PostgreSQL database. The problem I keep running into is that Knex will hang after inserting rows in the database.
I've been struggling with ...
2
votes
1
answer
3k
views
Node.js - process.exit(-1) [closed]
I found a lot of information about the node.js process.exit(), and different numbers are being passed. But I have a legacy project where they have used process.exit(-1) all over the codebase. I couldn'...
user avatar
user8737957