diff options
author | Shelley Vohr <shelley.vohr@gmail.com> | 2019-11-13 15:53:19 +0000 |
---|---|---|
committer | Shelley Vohr <shelley.vohr@gmail.com> | 2019-11-18 09:45:36 -0800 |
commit | 0f58bfd0633e357208822a1bc045c5e3bbbb3f6e (patch) | |
tree | ddc36517237c98dbe563fc374139a205610fbd6e /src | |
parent | 70281ce1f0598822d536a8c80c1a2b8fdfcd2a63 (diff) | |
download | android-node-v8-0f58bfd0633e357208822a1bc045c5e3bbbb3f6e.tar.gz android-node-v8-0f58bfd0633e357208822a1bc045c5e3bbbb3f6e.tar.bz2 android-node-v8-0f58bfd0633e357208822a1bc045c5e3bbbb3f6e.zip |
src: expose ability to set options
PR-URL: https://github.com/nodejs/node/pull/30466
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node.cc | 16 | ||||
-rw-r--r-- | src/node.h | 10 | ||||
-rw-r--r-- | src/node_options.h | 5 | ||||
-rw-r--r-- | src/node_worker.cc | 2 |
4 files changed, 21 insertions, 12 deletions
diff --git a/src/node.cc b/src/node.cc index 5379b42b57..91f07e447f 100644 --- a/src/node.cc +++ b/src/node.cc @@ -123,8 +123,6 @@ namespace node { using native_module::NativeModuleEnv; -using options_parser::kAllowedInEnvironment; -using options_parser::kDisallowedInEnvironment; using v8::Boolean; using v8::EscapableHandleScope; @@ -679,7 +677,7 @@ void ResetStdio() { int ProcessGlobalArgs(std::vector<std::string>* args, std::vector<std::string>* exec_args, std::vector<std::string>* errors, - bool is_env) { + OptionEnvvarSettings settings) { // Parse a few arguments which are specific to Node. std::vector<std::string> v8_args; @@ -689,7 +687,7 @@ int ProcessGlobalArgs(std::vector<std::string>* args, exec_args, &v8_args, per_process::cli_options.get(), - is_env ? kAllowedInEnvironment : kDisallowedInEnvironment, + settings, errors); if (!errors->empty()) return 9; @@ -851,12 +849,18 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv, return 9; } - const int exit_code = ProcessGlobalArgs(&env_argv, nullptr, errors, true); + const int exit_code = ProcessGlobalArgs(&env_argv, + nullptr, + errors, + kAllowedInEnvironment); if (exit_code != 0) return exit_code; } #endif - const int exit_code = ProcessGlobalArgs(argv, exec_argv, errors, false); + const int exit_code = ProcessGlobalArgs(argv, + exec_argv, + errors, + kDisallowedInEnvironment); if (exit_code != 0) return exit_code; // Set the process.title immediately after processing argv if --title is set. diff --git a/src/node.h b/src/node.h index f1e769a182..c80e626685 100644 --- a/src/node.h +++ b/src/node.h @@ -225,6 +225,16 @@ NODE_EXTERN void Init(int* argc, int* exec_argc, const char*** exec_argv); +enum OptionEnvvarSettings { + kAllowedInEnvironment, + kDisallowedInEnvironment +}; + +NODE_EXTERN int ProcessGlobalArgs(std::vector<std::string>* args, + std::vector<std::string>* exec_args, + std::vector<std::string>* errors, + OptionEnvvarSettings settings); + class NodeArrayBufferAllocator; // An ArrayBuffer::Allocator class with some Node.js-specific tweaks. If you do diff --git a/src/node_options.h b/src/node_options.h index c36c0ad160..30a976f48d 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -247,11 +247,6 @@ HostPort SplitHostPort(const std::string& arg, std::vector<std::string>* errors); void GetOptions(const v8::FunctionCallbackInfo<v8::Value>& args); -enum OptionEnvvarSettings { - kAllowedInEnvironment, - kDisallowedInEnvironment -}; - enum OptionType { kNoOp, kV8Option, diff --git a/src/node_worker.cc b/src/node_worker.cc index 72717331ee..9976ec3f0a 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -16,7 +16,7 @@ #include <string> #include <vector> -using node::options_parser::kDisallowedInEnvironment; +using node::kDisallowedInEnvironment; using v8::Array; using v8::ArrayBuffer; using v8::Boolean; |