Process not exiting?
See original GitHub issueHi,
I’m trying to use bookshelf.js to populate my database via a nodejs script (executed in a cronjob). However I noticed that the process doesn’t exit even after the records are successfully written to the database. Is there something I’m supposed to do to make it exit?
I’ve tried the following simple code and it doesn’t exit either:
var knex = require('knex')({
client: 'postgresql',
connection: {
host : '127.0.0.1',
user : 'npow',
password : '',
database : 'miserly',
charset : 'utf8'
}
});
var bookshelf = require('bookshelf')(knex);
console.log('here');
Issue Analytics
- State:
- Created 9 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Why is process not exiting and how to get it to exit
I'm using a pipe in order to let these run concurrently, and brackets to group the commands such that sleep occurs first (the...
Read more >Child Process not exiting in Piping [duplicate] - Stack Overflow
If you leave the line commented, wc command is only terminating because the parent exits and all of its file descriptors get closed....
Read more >Process not closing in Task Manager on Windows 11? Fix it now
Snap! Process not closing in Task Manager? Fix it now!Easy peasy, this video will guide you on the best solutions!
Read more >Issue 35122: Process not exiting on unhandled exception ...
I have attached a simple reproducer. When main() raises the unhandled exception, the process does not exit. However, if the size of data...
Read more >Ghostscript process does not exit - Google Groups
Ghostscript process does not exit. 656 views. Skip to first unread message ... until I manually kill the gs.exe process using Windows Task...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How about something along these lines:
Yeah, @carldanley just brought this up to me tonight as well, I guess this might be a good FAQ add.
But yeah, calling
knex.destroy(cb)
should do it. Orprocess.exit
which isn’t as graceful but gets the job done.The way to think about it is that opening pooled database connections is kind of like opening a new http server with
.createServer
… it won’t exit until you tell it to, so you should just tell it to explicitly when your script is finished.