diff options
author | AshCripps <Ashley.Cripps@ibm.com> | 2020-05-27 16:53:46 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-07-20 19:20:18 +0300 |
commit | 242bfb6bfc21d571ac5eb14b3c7db1ac9bcb9ee8 (patch) | |
tree | 1ddb9af1a00856df81bfa2b6a1c728354a23a6e2 /src/node_options.cc | |
parent | 2e82982984a595af24ffb260ff22eb0a73b075c7 (diff) |
src: allow setting a dir for all diagnostic output
Add a flag that allows for the setting of a directory where all
diagnostic output will be written to.
e.g. --redirect-warnings
Refs: https://github.com/nodejs/node/pull/33010#issuecomment-618544792
PR-URL: https://github.com/nodejs/node/pull/33584
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r-- | src/node_options.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/node_options.cc b/src/node_options.cc index 913366b3500..93a2268da41 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -146,6 +146,10 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { } } + if (cpu_prof && cpu_prof_dir.empty() && !diagnostic_dir.empty()) { + cpu_prof_dir = diagnostic_dir; + } + if (!heap_prof) { if (!heap_prof_name.empty()) { errors->push_back("--heap-prof-name must be used with --heap-prof"); @@ -159,6 +163,11 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) { errors->push_back("--heap-prof-interval must be used with --heap-prof"); } } + + if (heap_prof && heap_prof_dir.empty() && !diagnostic_dir.empty()) { + heap_prof_dir = diagnostic_dir; + } + debug_options_.CheckOptions(errors); #endif // HAVE_INSPECTOR } @@ -272,6 +281,11 @@ DebugOptionsParser::DebugOptionsParser() { } EnvironmentOptionsParser::EnvironmentOptionsParser() { + AddOption("--diagnostic-dir", + "set dir for all output files" + " (default: current working directory)", + &EnvironmentOptions::diagnostic_dir, + kAllowedInEnvironment); AddOption("--enable-source-maps", "experimental Source Map V3 support", &EnvironmentOptions::enable_source_maps, |