GeezerVison is showing github.com — src: expose ability to set options · nodejs/node@036a982
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node.cc +10-6Lines changed: 10 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 112 | 112 | namespace node { | 113 | 113 |
| 114 | 114 | using native_module::NativeModuleEnv; | 115 | | -using options_parser::kAllowedInEnvironment; | 116 | | -using options_parser::kDisallowedInEnvironment; | 117 | 115 |
| 118 | 116 | using v8::Boolean; | 119 | 117 | using v8::EscapableHandleScope; | @@ -631,7 +629,7 @@ void ResetStdio() { | 631 | 629 | int ProcessGlobalArgs(std::vector<std::string>* args, | 632 | 630 | std::vector<std::string>* exec_args, | 633 | 631 | std::vector<std::string>* errors, | 634 | | - bool is_env) { | | 632 | + OptionEnvvarSettings settings) { | 635 | 633 | // Parse a few arguments which are specific to Node. | 636 | 634 | std::vector<std::string> v8_args; | 637 | 635 |
| @@ -641,7 +639,7 @@ int ProcessGlobalArgs(std::vector<std::string>* args, | 641 | 639 | exec_args, | 642 | 640 | &v8_args, | 643 | 641 | per_process::cli_options.get(), | 644 | | - is_env ? kAllowedInEnvironment : kDisallowedInEnvironment, | | 642 | + settings, | 645 | 643 | errors); | 646 | 644 |
| 647 | 645 | if (!errors->empty()) return 9; | @@ -803,12 +801,18 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv, | 803 | 801 | return 9; | 804 | 802 | } | 805 | 803 |
| 806 | | - const int exit_code = ProcessGlobalArgs(&env_argv, nullptr, errors, true); | | 804 | + const int exit_code = ProcessGlobalArgs(&env_argv, | | 805 | + nullptr, | | 806 | + errors, | | 807 | + kAllowedInEnvironment); | 807 | 808 | if (exit_code != 0) return exit_code; | 808 | 809 | } | 809 | 810 | #endif | 810 | 811 |
| 811 | | - const int exit_code = ProcessGlobalArgs(argv, exec_argv, errors, false); | | 812 | + const int exit_code = ProcessGlobalArgs(argv, | | 813 | + exec_argv, | | 814 | + errors, | | 815 | + kDisallowedInEnvironment); | 812 | 816 | if (exit_code != 0) return exit_code; | 813 | 817 |
| 814 | 818 | // Set the process.title immediately after processing argv if --title is set. | |
Collapse file Copy file name to clipboardExpand all lines: src/node.h +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -219,6 +219,16 @@ NODE_EXTERN void Init(int* argc, | 219 | 219 | int* exec_argc, | 220 | 220 | const char*** exec_argv); | 221 | 221 |
| | 222 | +enum OptionEnvvarSettings { | | 223 | + kAllowedInEnvironment, | | 224 | + kDisallowedInEnvironment | | 225 | +}; | | 226 | + | | 227 | +NODE_EXTERN int ProcessGlobalArgs(std::vector<std::string>* args, | | 228 | + std::vector<std::string>* exec_args, | | 229 | + std::vector<std::string>* errors, | | 230 | + OptionEnvvarSettings settings); | | 231 | + | 222 | 232 | class NodeArrayBufferAllocator; | 223 | 233 |
| 224 | 234 | // An ArrayBuffer::Allocator class with some Node.js-specific tweaks. If you do | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.h -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -251,11 +251,6 @@ HostPort SplitHostPort(const std::string& arg, | 251 | 251 | std::vector<std::string>* errors); | 252 | 252 | void GetOptions(const v8::FunctionCallbackInfo<v8::Value>& args); | 253 | 253 |
| 254 | | -enum OptionEnvvarSettings { | 255 | | - kAllowedInEnvironment, | 256 | | - kDisallowedInEnvironment | 257 | | -}; | 258 | | - | 259 | 254 | enum OptionType { | 260 | 255 | kNoOp, | 261 | 256 | kV8Option, | |
Collapse file Copy file name to clipboardExpand all lines: src/node_worker.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 16 | 16 | #include <string> | 17 | 17 | #include <vector> | 18 | 18 |
| 19 | | -using node::options_parser::kDisallowedInEnvironment; | | 19 | +using node::kDisallowedInEnvironment; | 20 | 20 | using v8::Array; | 21 | 21 | using v8::ArrayBuffer; | 22 | 22 | using v8::Boolean; | |
|