diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2023-08-18 13:37:56 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-08-18 13:37:56 +0900 |
commit | 1894304d3345518a6f37d9f13a0e471e8433267a (patch) | |
tree | ea7fab794529a8fff9cf6fcc58fc90a2ddf1396a | |
parent | 9d5392fb02db33dbc9798f2472654426f79a33f2 (diff) |
[bash] Disable pipefail in command substitution
Fix #3382
-rw-r--r-- | shell/key-bindings.bash | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/key-bindings.bash b/shell/key-bindings.bash index d83f9d3e..03089d42 100644 --- a/shell/key-bindings.bash +++ b/shell/key-bindings.bash @@ -45,7 +45,7 @@ __fzf_cd__() { cmd="${FZF_ALT_C_COMMAND:-"command find -L . -mindepth 1 \\( -path '*/\\.*' -o -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune \ -o -type d -print 2> /dev/null | cut -b3-"}" opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore --reverse ${FZF_DEFAULT_OPTS-} ${FZF_ALT_C_OPTS-} +m" - dir=$(eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir" + dir=$(set +o pipefail; eval "$cmd" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd)) && printf 'builtin cd -- %q' "$dir" } __fzf_history__() { @@ -53,6 +53,7 @@ __fzf_history__() { opts="--height ${FZF_TMUX_HEIGHT:-40%} --bind=ctrl-z:ignore ${FZF_DEFAULT_OPTS-} -n2..,.. --scheme=history --bind=ctrl-r:toggle-sort ${FZF_CTRL_R_OPTS-} +m --read0" script='BEGIN { getc; $/ = "\n\t"; $HISTCOUNT = $ENV{last_hist} + 1 } s/^[ *]//; print $HISTCOUNT - $. . "\t$_" if !$seen{$_}++' output=$( + set +o pipefail builtin fc -lnr -2147483648 | last_hist=$(HISTTIMEFORMAT='' builtin history 1) perl -n -l0 -e "$script" | FZF_DEFAULT_OPTS="$opts" $(__fzfcmd) --query "$READLINE_LINE" |