diff options
author | Cheng Zhao <zcbenz@gmail.com> | 2021-10-06 04:22:21 +0300 |
---|---|---|
committer | Michael Dawson <mdawson@devrus.com> | 2021-10-14 00:27:27 +0300 |
commit | 3b72788afb7365e10ae1e97c71d1f60ee29f09f2 (patch) | |
tree | 2704d51811fb4d1dd3ce7d6c9122c9982bdb5c28 /src/node.h | |
parent | 4cf5563147cd562335ec02c4a78f9397a30e6701 (diff) |
src: add flags for controlling process behavior
PR-URL: https://github.com/nodejs/node/pull/40339
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <shelley.vohr@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/node.h b/src/node.h index f34ed393970..8d9e9935258 100644 --- a/src/node.h +++ b/src/node.h @@ -214,6 +214,20 @@ namespace node { class IsolateData; class Environment; +namespace ProcessFlags { +enum Flags : uint64_t { + kNoFlags = 0, + // Enable stdio inheritance, which is disabled by default. + kEnableStdioInheritance = 1 << 0, + // Disable reading the NODE_OPTIONS environment variable. + kDisableNodeOptionsEnv = 1 << 1, + // Do not parse CLI options. + kDisableCLIOptions = 1 << 2, + // Do not initialize ICU. + kNoICU = 1 << 3, +}; +} // namespace ProcessFlags + // TODO(addaleax): Officially deprecate this and replace it with something // better suited for a public embedder API. NODE_EXTERN int Start(int argc, char* argv[]); @@ -226,9 +240,16 @@ NODE_EXTERN int Stop(Environment* env); // 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); +NODE_EXTERN int InitializeNodeWithArgs( + std::vector<std::string>* argv, + std::vector<std::string>* exec_argv, + std::vector<std::string>* errors); +// TODO(zcbenz): Turn above overloaded version into below's default argument. +NODE_EXTERN int InitializeNodeWithArgs( + std::vector<std::string>* argv, + std::vector<std::string>* exec_argv, + std::vector<std::string>* errors, + ProcessFlags::Flags flags); enum OptionEnvvarSettings { kAllowedInEnvironment, |