mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
src: remove deprecated node::InitializeNodeWithArgs
PR-URL: https://github.com/nodejs/node/pull/58470 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
ba6651ab4f
commit
e0ae14ce73
3 changed files with 9 additions and 31 deletions
10
src/node.cc
10
src/node.cc
|
@ -823,7 +823,7 @@ static ExitCode InitializeNodeWithArgsInternal(
|
|||
std::vector<std::string>* exec_argv,
|
||||
std::vector<std::string>* errors,
|
||||
ProcessInitializationFlags::Flags flags) {
|
||||
// Make sure InitializeNodeWithArgs() is called only once.
|
||||
// Make sure InitializeNodeWithArgsInternal() is called only once.
|
||||
CHECK(!init_called.exchange(true));
|
||||
|
||||
// Initialize node_start_time to get relative uptime.
|
||||
|
@ -1021,14 +1021,6 @@ static ExitCode InitializeNodeWithArgsInternal(
|
|||
return ExitCode::kNoFailure;
|
||||
}
|
||||
|
||||
int InitializeNodeWithArgs(std::vector<std::string>* argv,
|
||||
std::vector<std::string>* exec_argv,
|
||||
std::vector<std::string>* errors,
|
||||
ProcessInitializationFlags::Flags flags) {
|
||||
return static_cast<int>(
|
||||
InitializeNodeWithArgsInternal(argv, exec_argv, errors, flags));
|
||||
}
|
||||
|
||||
static std::shared_ptr<InitializationResultImpl>
|
||||
InitializeOncePerProcessInternal(const std::vector<std::string>& args,
|
||||
ProcessInitializationFlags::Flags flags =
|
||||
|
|
16
src/node.h
16
src/node.h
|
@ -329,22 +329,6 @@ NODE_EXTERN int Start(int argc, char* argv[]);
|
|||
NODE_EXTERN int Stop(Environment* env,
|
||||
StopFlags::Flags flags = StopFlags::kNoFlags);
|
||||
|
||||
// Set up per-process state needed to run Node.js. This will consume arguments
|
||||
// from argv, fill exec_argv, and possibly add errors resulting from parsing
|
||||
// the arguments to `errors`. The return value is a suggested exit code for the
|
||||
// program; If it is 0, then initializing Node.js succeeded.
|
||||
// This runs a subset of the initialization performed by
|
||||
// InitializeOncePerProcess(), which supersedes this function.
|
||||
// The subset is roughly equivalent to the one given by
|
||||
// `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
|
||||
NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
|
||||
NODE_EXTERN int InitializeNodeWithArgs(
|
||||
std::vector<std::string>* argv,
|
||||
std::vector<std::string>* exec_argv,
|
||||
std::vector<std::string>* errors,
|
||||
ProcessInitializationFlags::Flags flags =
|
||||
ProcessInitializationFlags::kNoFlags));
|
||||
|
||||
// Set up per-process state needed to run Node.js. This will consume arguments
|
||||
// from args, and return information about the initialization success,
|
||||
// including the arguments split into argv/exec_argv, a list of potential
|
||||
|
|
|
@ -81,13 +81,15 @@ class NodeZeroIsolateTestFixture : public ::testing::Test {
|
|||
if (!node_initialized) {
|
||||
node_initialized = true;
|
||||
uv_os_unsetenv("NODE_OPTIONS");
|
||||
std::vector<std::string> argv { "cctest" };
|
||||
std::vector<std::string> exec_argv;
|
||||
std::vector<std::string> errors;
|
||||
std::vector<std::string> argv{"cctest"};
|
||||
|
||||
int exitcode = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors);
|
||||
CHECK_EQ(exitcode, 0);
|
||||
CHECK(errors.empty());
|
||||
std::shared_ptr<node::InitializationResult> result =
|
||||
node::InitializeOncePerProcess(
|
||||
argv,
|
||||
node::ProcessInitializationFlags::
|
||||
kLegacyInitializeNodeWithArgsBehavior);
|
||||
CHECK_EQ(result->exit_code(), 0);
|
||||
CHECK(result->errors().empty());
|
||||
}
|
||||
CHECK_EQ(0, uv_loop_init(¤t_loop));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue