Skip to content
Myr

Use $SHELL instead of bash if it's known to support 'pipefail'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

when running the default find command Close #3339 Close #3364

authored by Junegunn Choi · committed by Junegunn Choi · parent 0130f64 · Browse files · 1 file+11 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−1 removed

  • other:+11 added−1 removed

1 file+11 added−1 removed

modified:src/reader.go+11 added-1 removed
4 unmodified lines
5 "context"6 "io"7 "os"8 "os/exec"9 "path"10 "path/filepath"11 "sync"12 "sync/atomic"13 "time"
84 unmodified lines
98func (r *Reader) ReadSource() {99 r.startEventPoller()100 var success bool101 if util.IsTty() {101 // The default command for *nix requires bash102 // The default command for *nix requires a shell that supports "pipefail"103 // https://unix.stackexchange.com/a/654932/62171104 shell := "bash"105 currentShell := os.Getenv("SHELL")106 currentShellName := path.Base(currentShell)107 for _, shellName := range []string{"bash", "zsh", "ksh", "ash", "hush", "mksh", "yash"} {108 if currentShellName == shellName {109 shell = currentShell110 break111 }112 }113 cmd := os.Getenv("FZF_DEFAULT_COMMAND")114 if len(cmd) == 0 {115 if defaultCommand != "" {116 success = r.readFromCommand(&shell, defaultCommand)
95 unmodified lines