Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodejs - process.exit(1) throws error #381

Closed
prashathsenthil opened this issue Nov 29, 2016 · 1 comment
Closed

Nodejs - process.exit(1) throws error #381

prashathsenthil opened this issue Nov 29, 2016 · 1 comment

Comments

@prashathsenthil
Copy link

prashathsenthil commented Nov 29, 2016

I have a node/express app and would like to exit the process with exit code 1 (process.exit(1)) at certain scenarios. When i attempt to do that i get the following error,

9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/n/lib/node_modules/npm/lib/utils/lifecycle.js:214:16)
9 verbose stack at emitTwo (events.js:87:13) 9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (/n/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13) 9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:821:16) 9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)`

On the other hand if i just exit without specifying an exit code like just process.exit() then it works fine.

In this node/express app i use promises and also spawn a child process which acts as a data source.

@Knighton910
Copy link
Contributor

Knighton910 commented Dec 8, 2016

Hope this link help clear things up

http://stackoverflow.com/questions/5266152/how-to-exit-in-node-js

just in case Unitech/pm2#1149

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants