Skip to content

Commit e0ae14c

Browse files
legendecasnodejs-github-bot
authored andcommitted
src: remove deprecated node::InitializeNodeWithArgs
PR-URL: #58470 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent ba6651a commit e0ae14c

File tree

3 files changed

+10
-32
lines changed

3 files changed

+10
-32
lines changed

src/node.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ static ExitCode InitializeNodeWithArgsInternal(
823823
std::vector<std::string>* exec_argv,
824824
std::vector<std::string>* errors,
825825
ProcessInitializationFlags::Flags flags) {
826-
// Make sure InitializeNodeWithArgs() is called only once.
826+
// Make sure InitializeNodeWithArgsInternal() is called only once.
827827
CHECK(!init_called.exchange(true));
828828

829829
// Initialize node_start_time to get relative uptime.
@@ -1021,14 +1021,6 @@ static ExitCode InitializeNodeWithArgsInternal(
10211021
return ExitCode::kNoFailure;
10221022
}
10231023

1024-
int InitializeNodeWithArgs(std::vector<std::string>* argv,
1025-
std::vector<std::string>* exec_argv,
1026-
std::vector<std::string>* errors,
1027-
ProcessInitializationFlags::Flags flags) {
1028-
return static_cast<int>(
1029-
InitializeNodeWithArgsInternal(argv, exec_argv, errors, flags));
1030-
}
1031-
10321024
static std::shared_ptr<InitializationResultImpl>
10331025
InitializeOncePerProcessInternal(const std::vector<std::string>& args,
10341026
ProcessInitializationFlags::Flags flags =

src/node.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -329,22 +329,6 @@ NODE_EXTERN int Start(int argc, char* argv[]);
329329
NODE_EXTERN int Stop(Environment* env,
330330
StopFlags::Flags flags = StopFlags::kNoFlags);
331331

332-
// Set up per-process state needed to run Node.js. This will consume arguments
333-
// from argv, fill exec_argv, and possibly add errors resulting from parsing
334-
// the arguments to `errors`. The return value is a suggested exit code for the
335-
// program; If it is 0, then initializing Node.js succeeded.
336-
// This runs a subset of the initialization performed by
337-
// InitializeOncePerProcess(), which supersedes this function.
338-
// The subset is roughly equivalent to the one given by
339-
// `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
340-
NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
341-
NODE_EXTERN int InitializeNodeWithArgs(
342-
std::vector<std::string>* argv,
343-
std::vector<std::string>* exec_argv,
344-
std::vector<std::string>* errors,
345-
ProcessInitializationFlags::Flags flags =
346-
ProcessInitializationFlags::kNoFlags));
347-
348332
// Set up per-process state needed to run Node.js. This will consume arguments
349333
// from args, and return information about the initialization success,
350334
// including the arguments split into argv/exec_argv, a list of potential

test/cctest/node_test_fixture.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ class NodeZeroIsolateTestFixture : public ::testing::Test {
8181
if (!node_initialized) {
8282
node_initialized = true;
8383
uv_os_unsetenv("NODE_OPTIONS");
84-
std::vector<std::string> argv { "cctest" };
85-
std::vector<std::string> exec_argv;
86-
std::vector<std::string> errors;
87-
88-
int exitcode = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors);
89-
CHECK_EQ(exitcode, 0);
90-
CHECK(errors.empty());
84+
std::vector<std::string> argv{"cctest"};
85+
86+
std::shared_ptr<node::InitializationResult> result =
87+
node::InitializeOncePerProcess(
88+
argv,
89+
node::ProcessInitializationFlags::
90+
kLegacyInitializeNodeWithArgsBehavior);
91+
CHECK_EQ(result->exit_code(), 0);
92+
CHECK(result->errors().empty());
9193
}
9294
CHECK_EQ(0, uv_loop_init(&current_loop));
9395
}

0 commit comments

Comments
 (0)