src: add --disable-sigusr1 to prevent signal i/o thread · nodejs/node@94d3fe1 · GitHub
Skip to content

Commit 94d3fe1

Browse files
RafaelGSSaduh95
authored andcommitted
src: add --disable-sigusr1 to prevent signal i/o thread
This commit adds a new flag `--disable-sigusr1` to prevent the SignalIOThread to be up listening the SIGUSR1 events and then starting the debugging session. PR-URL: #56441 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7d1676e commit 94d3fe1

6 files changed

Lines changed: 50 additions & 1 deletion

File tree

doc/api/cli.md

Lines changed: 14 additions & 0 deletions

src/env-inl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,8 @@ inline bool Environment::no_global_search_paths() const {
691691
}
692692

693693
inline bool Environment::should_start_debug_signal_handler() const {
694-
return (flags_ & EnvironmentFlags::kNoStartDebugSignalHandler) == 0;
694+
return ((flags_ & EnvironmentFlags::kNoStartDebugSignalHandler) == 0) &&
695+
!options_->disable_sigusr1;
695696
}
696697

697698
inline bool Environment::no_browser_globals() const {

src/node_options.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
389389
" (default: current working directory)",
390390
&EnvironmentOptions::diagnostic_dir,
391391
kAllowedInEnvvar);
392+
AddOption("--disable-sigusr1",
393+
"Disable inspector thread to be listening for SIGUSR1 signal",
394+
&EnvironmentOptions::disable_sigusr1,
395+
kAllowedInEnvvar,
396+
false);
392397
AddOption("--dns-result-order",
393398
"set default value of verbatim in dns.lookup. Options are "
394399
"'ipv4first' (IPv4 addresses are placed before IPv6 addresses) "

src/node_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class EnvironmentOptions : public Options {
116116
bool abort_on_uncaught_exception = false;
117117
std::vector<std::string> conditions;
118118
bool detect_module = true;
119+
bool disable_sigusr1 = false;
119120
bool print_required_tla = false;
120121
bool require_module = true;
121122
std::string dns_result_order;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
console.log('pid is', process.pid);
2+
setInterval(() => {}, 1000);
Lines changed: 26 additions & 0 deletions

0 commit comments

Comments
 (0)