Skip to content

Commit

Permalink
src: make InitializeNodeWithArgs() official public API
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Jun 7, 2021
1 parent 68157e8 commit 1b04663
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 7 additions & 6 deletions shell/app/node_main.cc
Expand Up @@ -172,9 +172,13 @@ int NodeMain(int argc, char* argv[]) {
// Parse and set Node.js cli flags.
SetNodeCliFlags();

int exec_argc;
const char** exec_argv;
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
std::vector<std::string> args(argv, argv + argc); // NOLINT
std::vector<std::string> exec_args;
std::vector<std::string> errors;
node::InitializeNodeWithArgs(&args, &exec_args, &errors);

for (const std::string& error : errors)
fprintf(stderr, "%s: %s\n", args[0].c_str(), error.c_str());

gin::V8Initializer::LoadV8Snapshot(
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
Expand All @@ -201,9 +205,6 @@ int NodeMain(int argc, char* argv[]) {
isolate_data = node::CreateIsolateData(isolate, loop, gin_env.platform());
CHECK_NE(nullptr, isolate_data);

std::vector<std::string> args(argv, argv + argc); // NOLINT
std::vector<std::string> exec_args(exec_argv,
exec_argv + exec_argc); // NOLINT
env = node::CreateEnvironment(isolate_data, gin_env.context(), args,
exec_args);
CHECK_NOT_NULL(env);
Expand Down
3 changes: 1 addition & 2 deletions shell/common/node_bindings.cc
Expand Up @@ -366,9 +366,8 @@ void NodeBindings::Initialize() {
fprintf(stderr, "%s: %s\n", argv[0].c_str(), error.c_str());
}

if (exit_code != 0) {
if (exit_code != 0)
exit(exit_code);
}

#if defined(OS_WIN)
// uv_init overrides error mode to suppress the default crash dialog, bring
Expand Down

0 comments on commit 1b04663

Please sign in to comment.