Page MenuHomePhabricator

After removing `process.exit(1)`, Node exits with error code 0 after throwing
Closed, ResolvedPublic

Description

We changed this in D11426, but on my machine it changed the behavior:

$ 'node' '/Users/epriestley/dev/core/lib/phabricator/support/aphlict/server/aphlict_server.js' '--client-port=22280' '--admin-port=22281' '--admin-host=localhost' '--log=/var/log/aphlict.log' '--test=true'
[Tue Jan 20 2015 16:00:05 GMT-0800 (PST)] 
<<< UNCAUGHT EXCEPTION! >>>

Error: You need to install the Node.js "ws" module for websocket support. See "Notifications User Guide: Setup and Configuration" in the documentation for instructions. Error: Cannot find module 'ws'
    at Object.<anonymous> (/Users/epriestley/dev/core/lib/phabricator/support/aphlict/server/aphlict_server.js:69:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3
$ echo $?
0

This might be a version issue since D11426 claimed that the process exited nonzero.

Also verified that the exit status was non-zero.

$ node --version
v0.10.33

To move forward:

  • Offhand, I'm not sure how to make Node exit non-abruptly with an error status.
  • The process.exit(0) after the configuration test succeeds should probably also be removed.

Revisions and Commits

Event Timeline

epriestley raised the priority of this task from to Normal.
epriestley updated the task description. (Show Details)
epriestley added a project: Aphlict.

Interesting. So ./bin/aphlict debug exits with 1 but running node './support/aphlict/server/aphlict_server.js' '--client-port=22280' '--admin-port=22281' '--admin-host=localhost' '--log=/var/log/aphlict.log' exits with 0.

This has been discussed on the https://groups.google.com/forum/#!topic/nodejs/zF7GEoPccqw as well.

Pretty much, the easiest option is to set your desired exit code somewhere, and use the exit event to overwrite a 0 exit code.