Description
- Node.js 8.9.1:
- Windows 10:
- Scope (code, runtime):
We have embedded nodejs into our C++ crossplatform app. We faced a crash bug, which was cause by the lack of stdin when you do not run the node from command line. We noticed that there is already a pull request #11863 for this issue and we have these changes in our nodejs code. But this does not solve our problem as the PlatformInit()
function in node.cc never gets called. Here is how we initialise node and v8 in our program:
platform_ = new node::NodePlatform(8, loop_, nullptr);
node::i18n::InitializeICUDirectory("");
v8::V8::InitializePlatform(platform_);
v8::V8::Initialize();
copied directly from SetUp()
function in node_test_fixture.h
.
interestingly we just face this problem on Windows not on macOs. We solved it now by adding this line
NODE_EXTERN void PlatformInit();
to node.h
file in the node namespace, and then calling PlatformInit()
before creating the NodePlatform. So now our initialisation looks like this:
node::PlatformInit(); // new line added
platform_ = new node::NodePlatform(8, loop_, nullptr);
node::i18n::InitializeICUDirectory("");
v8::V8::InitializePlatform(platform_);
v8::V8::Initialize();
Now we are wondering is our initialisation wrong at first place or is this really a bug and we need to create a pull request for it. Please advice.