diff --git a/src/fish.cpp b/src/fish.cpp index 572fbe3e0..eaef8755e 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -324,7 +324,7 @@ int main(int argc, char **argv) { program_name = L"fish"; set_main_thread(); setup_fork_guards(); - + signal_unblock_all(); setlocale(LC_ALL, ""); fish_setlocale(); diff --git a/src/signal.cpp b/src/signal.cpp index 93709a287..c3766d9de 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -387,6 +387,13 @@ void signal_block(bool force) { // debug( 0, L"signal block level increased to %d", block_count ); } +/// Ensure we did not inherit any blocked signals. See issue #3964. +void signal_unblock_all() { + sigset_t iset; + sigemptyset(&iset); + sigprocmask(SIG_SETMASK, &iset, NULL); +} + void signal_unblock(bool force) { if (!force && ignore_signal_block) return; diff --git a/src/signal.h b/src/signal.h index 436945105..06fe37cf9 100644 --- a/src/signal.h +++ b/src/signal.h @@ -26,6 +26,9 @@ void signal_set_handlers(); /// default action (SIG_DFL) will be set void signal_handle(int sig, int do_handle); +/// Ensure we did not inherit any blocked signals. See issue #3964. +void signal_unblock_all(); + /// Block all signals. void signal_block(bool force = false);