@@ -115,6 +115,9 @@ namespace Javet {
115
115
if (!jniEnv->CallStaticBooleanMethod (jclassV8Host, jmethodIDV8HostIsLibraryReloadable)) {
116
116
v8::V8::Dispose ();
117
117
v8::V8::DisposePlatform ();
118
+ #ifdef ENABLE_NODE
119
+ node::TearDownOncePerProcess ();
120
+ #endif
118
121
GlobalV8Platform.reset ();
119
122
#ifndef ENABLE_NODE
120
123
GlobalV8ArrayBufferAllocator.reset ();
@@ -143,18 +146,19 @@ namespace Javet {
143
146
#ifdef ENABLE_NODE
144
147
uv_setup_args (0 , nullptr );
145
148
std::vector<std::string> args{ DEFAULT_SCRIPT_NAME };
146
- std::vector<std::string> execArgs;
147
- std::vector<std::string> errors;
148
149
auto flags = static_cast <node::ProcessInitializationFlags::Flags>(
149
150
node::ProcessInitializationFlags::kNoFlags
150
151
| node::ProcessInitializationFlags::kNoStdioInitialization
151
152
| node::ProcessInitializationFlags::kNoDefaultSignalHandling
152
153
| node::ProcessInitializationFlags::kNoInitializeV8
153
154
| node::ProcessInitializationFlags::kNoInitializeNodeV8Platform
155
+ #ifndef ENABLE_I18N
156
+ | node::ProcessInitializationFlags::kNoICU
157
+ #endif
154
158
| node::ProcessInitializationFlags::kNoInitializeCppgc );
155
- int exitCode = node::InitializeNodeWithArgs (& args, &execArgs, &errors , flags);
156
- if (exitCode != 0 ) {
157
- LOG_ERROR (" Failed to call node::InitializeNodeWithArgs ()." );
159
+ std::unique_ptr<node::InitializationResult> result = node::InitializeOncePerProcess ( args, flags);
160
+ if (result-> exit_code () != 0 ) {
161
+ LOG_ERROR (" Failed to call node::InitializeOncePerProcess ()." );
158
162
}
159
163
Javet::V8Native::GlobalV8Platform = node::MultiIsolatePlatform::Create (4 );
160
164
#else
@@ -174,7 +178,7 @@ namespace Javet {
174
178
}
175
179
#endif
176
180
LOG_INFO (" V8::Initialize() ends." );
181
+ }
177
182
}
178
183
}
179
- }
180
184
0 commit comments