Function with --on-signal=SIGINT in config.fish doesn't stop config.fish from being interrupted by ^C
As described in the title, with the following minimal config.fish:
if status is-interactive
# No greeting
set fish_greeting
function ignore_sigint --on-signal SIGINT
# and prevent multiple activations
functions -e ignore_sigint
echo ignore sigint triggered
end
# blocking task which shouldn't be interrupted thanks to `ignore_sigint`
sleep 10
# yet this echo is never reached
echo after sleep
# Alias for testing when in interactive shell
alias lah='ls -lah'
endand no conf.d or functions folder, trying to input ^c seems to still send the SIGINT to the process running config.fish despite ignore_sigint catching it:
^Cignore sigint triggered
user@host ~> lah
fish: Unknown command: lah
user@host ~ [127]> This also happens using trap instead of the ignore_sigint function.
Although the fish documentation isn't too clear on what the target behavior should be, I believe this shouldn't be happening and only the currently running child process, here sleep 10, should be receiving a SIGINT upon inputing ^C.
Imho, this is a less confusing behavior, similar to the one bash has when using trap "command" SIGINT, that still allows the user to stop the whole script from executing upon receiving SIGINT using kill $fish_pid (with SIGTERM or by deactivating the functions that listens to the signal first) if they really wish to.
- fish version: 4.8.1
- os version: arch linux (kernel 7.1.9-arch1-2)
Source: fish-shell/fish-shell