Skip to content

Commit

Permalink
[fish] exit as well when called from non-interactive shell (#3467)
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 cannot use `return`, 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).

Unlike in POSIX, fish’s `exit` is however documented to no cause the calling
shell to exit when executed in a sourced script (see:
https://github.com/fish-shell/fish-shell/blob/0f70b2c0d310d97b5956b5360ad6cbc548baf72d/doc_src/cmds/exit.rst?plain=1#L20
)

Signed-off-by: Christoph Anton Mitterer <[email protected]>
Co-authored-by: Junegunn Choi <[email protected]>
  • Loading branch information
calestyo and junegunn authored Oct 12, 2023
1 parent f212baf commit 7e89458
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 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

status is-interactive; or exit 0


# Key bindings
# ------------
function fzf_key_bindings
Expand Down

0 comments on commit 7e89458

Please sign in to comment.