diff options
author | Ron Korving <rkorving@wizcorp.jp> | 2013-11-06 12:23:35 +0900 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2013-12-31 14:38:09 -0800 |
commit | 3917232030ec3b096fa08bb03b0bdc82301c0ac0 (patch) | |
tree | 8a137acd0260988de189c6a2b7a871e281a69bb0 | |
parent | 6f8aa24d1ee0c8502ec4c3dae3820668ae7fc435 (diff) | |
download | node-3917232030ec3b096fa08bb03b0bdc82301c0ac0.tar.gz |
docs: process.on('exit') receives exit code
The fact that the "exit" event passes the exit code as an argument
as omitted from the documentation. This adds the explanation and
augments the example code to show that.
-rw-r--r-- | doc/api/process.markdown | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/api/process.markdown b/doc/api/process.markdown index 0514f5e2e..980254e6c 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -11,15 +11,16 @@ It is an instance of [EventEmitter][]. Emitted when the process is about to exit. This is a good hook to perform constant time checks of the module's state (like for unit tests). The main event loop will no longer be run after the 'exit' callback finishes, so -timers may not be scheduled. +timers may not be scheduled. The callback takes one argument, the code the +process is exiting with. Example of listening for `exit`: - process.on('exit', function() { + process.on('exit', function(code) { setTimeout(function() { console.log('This will not run'); }, 0); - console.log('About to exit.'); + console.log('About to exit with code:', code); }); ## Event: 'uncaughtException' |