src: set node_is_initialized in node::Init

This can make node_is_initialized correctly set to true for applications
that use node::Init to embed iojs.

PR-URL: https://github.com/iojs/io.js/pull/225/
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
pull/531/head
Cheng Zhao 2015-01-12 13:31:25 -08:00 committed by Ben Noordhuis
parent 668420d1f7
commit 22e1aea8a0
1 changed files with 5 additions and 1 deletions

View File

@ -3426,6 +3426,11 @@ void Init(int* argc,
if (!use_debug_agent) { if (!use_debug_agent) {
RegisterDebugSignalHandler(); RegisterDebugSignalHandler();
} }
// We should set node_is_initialized here instead of in node::Start,
// otherwise embedders using node::Init to initialize everything will not be
// able to set it and native modules will not load for them.
node_is_initialized = true;
} }
@ -3634,7 +3639,6 @@ int Start(int argc, char** argv) {
int code; int code;
V8::Initialize(); V8::Initialize();
node_is_initialized = true;
// Fetch a reference to the main isolate, so we have a reference to it // Fetch a reference to the main isolate, so we have a reference to it
// even when we need it to access it from another (debugger) thread. // even when we need it to access it from another (debugger) thread.