Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 036a982

Browse filesBrowse files
codebytereMylesBorins
authored andcommitted
src: expose ability to set options
PR-URL: #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>
1 parent b99eca9 commit 036a982
Copy full SHA for 036a982

File tree

Expand file treeCollapse file tree

4 files changed

+21
-12
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+21
-12
lines changed
Open diff view settings
Collapse file

‎src/node.cc‎

Copy file name to clipboardExpand all lines: src/node.cc
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@
112112
namespace node {
113113

114114
using native_module::NativeModuleEnv;
115-
using options_parser::kAllowedInEnvironment;
116-
using options_parser::kDisallowedInEnvironment;
117115

118116
using v8::Boolean;
119117
using v8::EscapableHandleScope;
@@ -631,7 +629,7 @@ void ResetStdio() {
631629
int ProcessGlobalArgs(std::vector<std::string>* args,
632630
std::vector<std::string>* exec_args,
633631
std::vector<std::string>* errors,
634-
bool is_env) {
632+
OptionEnvvarSettings settings) {
635633
// Parse a few arguments which are specific to Node.
636634
std::vector<std::string> v8_args;
637635

@@ -641,7 +639,7 @@ int ProcessGlobalArgs(std::vector<std::string>* args,
641639
exec_args,
642640
&v8_args,
643641
per_process::cli_options.get(),
644-
is_env ? kAllowedInEnvironment : kDisallowedInEnvironment,
642+
settings,
645643
errors);
646644

647645
if (!errors->empty()) return 9;
@@ -803,12 +801,18 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
803801
return 9;
804802
}
805803

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);
807808
if (exit_code != 0) return exit_code;
808809
}
809810
#endif
810811

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);
812816
if (exit_code != 0) return exit_code;
813817

814818
// Set the process.title immediately after processing argv if --title is set.
Collapse file

‎src/node.h‎

Copy file name to clipboardExpand all lines: src/node.h
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,16 @@ NODE_EXTERN void Init(int* argc,
219219
int* exec_argc,
220220
const char*** exec_argv);
221221

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+
222232
class NodeArrayBufferAllocator;
223233

224234
// An ArrayBuffer::Allocator class with some Node.js-specific tweaks. If you do
Collapse file

‎src/node_options.h‎

Copy file name to clipboardExpand all lines: src/node_options.h
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,6 @@ HostPort SplitHostPort(const std::string& arg,
251251
std::vector<std::string>* errors);
252252
void GetOptions(const v8::FunctionCallbackInfo<v8::Value>& args);
253253

254-
enum OptionEnvvarSettings {
255-
kAllowedInEnvironment,
256-
kDisallowedInEnvironment
257-
};
258-
259254
enum OptionType {
260255
kNoOp,
261256
kV8Option,
Collapse file

‎src/node_worker.cc‎

Copy file name to clipboardExpand all lines: src/node_worker.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <string>
1717
#include <vector>
1818

19-
using node::options_parser::kDisallowedInEnvironment;
19+
using node::kDisallowedInEnvironment;
2020
using v8::Array;
2121
using v8::ArrayBuffer;
2222
using v8::Boolean;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.