summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node.cc1
-rw-r--r--src/node.js6
2 files changed, 3 insertions, 4 deletions
diff --git a/src/node.cc b/src/node.cc
index a593e79de..2cbd5c5cb 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -2772,6 +2772,7 @@ char** Init(int argc, char *argv[]) {
void EmitExit(v8::Handle<v8::Object> process_l) {
// process.emit('exit')
+ process_l->Set(String::NewSymbol("_exiting"), True());
Local<Value> emit_v = process_l->Get(String::New("emit"));
assert(emit_v->IsFunction());
Local<Function> emit = Local<Function>::Cast(emit_v);
diff --git a/src/node.js b/src/node.js
index 4da1f5a8f..bbda8c80c 100644
--- a/src/node.js
+++ b/src/node.js
@@ -409,11 +409,9 @@
};
startup.processKillAndExit = function() {
- var exiting = false;
-
process.exit = function(code) {
- if (!exiting) {
- exiting = true;
+ if (!process._exiting) {
+ process._exiting = true;
process.emit('exit', code || 0);
}
process.reallyExit(code || 0);