Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-02-28 04:40:54 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-21 12:57:34 +0300
commitd7f11077f15f52a2db191d3a5bcc41581cb7361f (patch)
treef81bbd7d175192efcf599269ec8df6b0aebcd201 /src/node.h
parent821e21de8cb96bb549ea01bcb59c8bb0e27e218a (diff)
src: make InitializeNodeWithArgs() official public API
This is a decent replacement for the to-be-deprecated Init() API. PR-URL: https://github.com/nodejs/node/pull/30467 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index b25afe3150f..a003e021a21 100644
--- a/src/node.h
+++ b/src/node.h
@@ -229,10 +229,20 @@ NODE_EXTERN int Stop(Environment* env);
// TODO(addaleax): Officially deprecate this and replace it with something
// better suited for a public embedder API.
+// It is recommended to use InitializeNodeWithArgs() instead as an embedder.
+// Init() calls InitializeNodeWithArgs() and exits the process with the exit
+// code returned from it.
NODE_EXTERN void Init(int* argc,
const char** argv,
int* exec_argc,
const char*** exec_argv);
+// 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.
+NODE_EXTERN int InitializeNodeWithArgs(std::vector<std::string>* argv,
+ std::vector<std::string>* exec_argv,
+ std::vector<std::string>* errors);
enum OptionEnvvarSettings {
kAllowedInEnvironment,