diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2014-01-18 22:49:33 +0000 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2014-01-22 00:39:13 +0400 |
commit | e57ab7ba06e079eb15c97b228d3fbee2a1514d9b (patch) | |
tree | 84661baff2fdba8fbe7fc1e2be8c83e8ac704aa1 /src/node.cc | |
parent | 1442c1c6de1009a7f451a443c02b1450bcb5bc44 (diff) | |
download | node-new-e57ab7ba06e079eb15c97b228d3fbee2a1514d9b.tar.gz |
node: `EmitExit` should not call `exit()`
Before this commit `RunAtExit` and `env->Dispose()` were never reached,
because `EmitExit` was always colling `exit`.
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/node.cc b/src/node.cc index 25283c0dca..47ef87b77f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3315,7 +3315,7 @@ void AtExit(void (*cb)(void* arg), void* arg) { } -void EmitExit(Environment* env) { +int EmitExit(Environment* env) { // process.emit('exit') HandleScope handle_scope(env->isolate()); Context::Scope context_scope(env->context()); @@ -3332,7 +3332,7 @@ void EmitExit(Environment* env) { }; MakeCallback(env, process_object, "emit", ARRAY_SIZE(args), args); - exit(code); + return code; } @@ -3406,6 +3406,7 @@ int Start(int argc, char** argv) { V8::SetEntropySource(crypto::EntropySource); #endif + int code; V8::Initialize(); { Locker locker(node_isolate); @@ -3417,7 +3418,7 @@ int Start(int argc, char** argv) { // be removed. Context::Scope context_scope(env->context()); uv_run(env->event_loop(), UV_RUN_DEFAULT); - EmitExit(env); + code = EmitExit(env); RunAtExit(env); env->Dispose(); env = NULL; @@ -3431,7 +3432,7 @@ int Start(int argc, char** argv) { delete[] exec_argv; exec_argv = NULL; - return 0; + return code; } |