From 9397ede963efd100a3c2c00d18ac0eb49b3dfbea Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 13 Jul 2022 21:49:05 +0800 Subject: [PATCH] Clear signals after running initial commands If you run an initial command via `fish -c`, and that command is cancelled e.g. via control-C, then ensure that the cancellation signal is cleared before running config files. Fixes #9024 (cherry picked from commit 137a4ecdf53b949be72ae29f4acce325a2f33c81) --- CHANGELOG.rst | 2 +- src/fish.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 6d9466c73..04aeaa3c5 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -10,7 +10,7 @@ This release also fixes a number of problems identified in fish 3.5.0. - Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`). - On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`). - ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`). - +- Cancelling an initial command (from fish's ``--init-command`` option) with :kbd:`Control-C` no longer prevents configuration scripts from running (:issue:`9024`). -------------- diff --git a/src/fish.cpp b/src/fish.cpp index 9a07f78f9..d16d6a4a3 100644 --- a/src/fish.cpp +++ b/src/fish.cpp @@ -548,6 +548,9 @@ int main(int argc, char **argv) { res = run_command_list(parser, &opts.postconfig_cmds, {}); } + // Clear signals in case we were interrupted (#9024). + signal_clear_cancel(); + if (!opts.batch_cmds.empty()) { // Run the commands specified as arguments, if any. if (get_login()) {