Skip to content

Commit

Permalink
[fish] exit as well when called from non-interactive shell
Browse files Browse the repository at this point in the history
Just like with the other shells, exit fish to, if called from a non-interactive
shell.

We use an `if`-block and don’t just return immediately for now, as older
versions of fish (namely < 3.4.0) did not support to use `return` in `.`-scripts
(this was only added with fish commit 3359e5d2e9bcbf19d1652636c8e448a6889302ae).

Just using `exit` instead of a `return` wouldn’t be a proper solution either, as
it would exit the whole shell, when `shell/key-bindings.fish` was executed or
sourced from a non-interactive shell.
While this should of course never happen, the idea of the whole check is to
handle the situation gracefully, which `exit` can thus not do.

Signed-off-by: Christoph Anton Mitterer <[email protected]>
  • Loading branch information
calestyo committed Sep 24, 2023
1 parent a8f9432 commit 5cb5bbd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shell/key-bindings.fish
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# - $FZF_ALT_C_COMMAND
# - $FZF_ALT_C_OPTS

if status is-interactive


# Key bindings
# ------------
function fzf_key_bindings
Expand Down Expand Up @@ -170,3 +173,6 @@ function fzf_key_bindings
end

end


end

0 comments on commit 5cb5bbd

Please sign in to comment.