diff options
author | James M Snell <jasnell@gmail.com> | 2016-12-04 10:38:35 -0800 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-01-30 11:11:47 -0800 |
commit | 03e89b3ff298c63e9620f1547094f7fca76edde7 (patch) | |
tree | b8bb5b52dfbfa437ca4c0df490131b184ccf9d33 /src/node_config.cc | |
parent | 5e1f32fd94f53acbec6c5f6eb4d2de5fdef2cd67 (diff) | |
download | node-new-03e89b3ff298c63e9620f1547094f7fca76edde7.tar.gz |
process: add --redirect-warnings command line argument
The --redirect-warnings command line argument allows process warnings
to be written to a specified file rather than printed to stderr.
Also adds an equivalent NODE_REDIRECT_WARNINGS environment variable.
If the specified file cannot be opened or written to for any reason,
the argument is ignored and the warning is printed to stderr.
If the file already exists, it will be appended to.
PR-URL: https://github.com/nodejs/node/pull/10116
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'src/node_config.cc')
-rw-r--r-- | src/node_config.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node_config.cc b/src/node_config.cc index 401345f6a6..60001207f1 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -12,6 +12,7 @@ using v8::Context; using v8::Local; using v8::Object; using v8::ReadOnly; +using v8::String; using v8::Value; // The config binding is used to provide an internal view of compile or runtime @@ -44,6 +45,15 @@ void InitConfig(Local<Object> target, if (config_preserve_symlinks) READONLY_BOOLEAN_PROPERTY("preserveSymlinks"); + + if (config_warning_file != nullptr) { + Local<String> name = OneByteString(env->isolate(), "warningFile"); + Local<String> value = String::NewFromUtf8(env->isolate(), + config_warning_file, + v8::NewStringType::kNormal) + .ToLocalChecked(); + target->DefineOwnProperty(env->context(), name, value).FromJust(); + } } // InitConfig } // namespace node |