From 22e1aea8a025b6439493dec4d44afe4c9f454c86 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 12 Jan 2015 13:31:25 -0800 Subject: [PATCH] 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 --- src/node.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/node.cc b/src/node.cc index 59a5b31901f..c9aaf7fb1c8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -3426,6 +3426,11 @@ void Init(int* argc, if (!use_debug_agent) { 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; V8::Initialize(); - node_is_initialized = true; // 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.