mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-12-23 03:19:01 +00:00
Use $SHELL instead of bash if it's known to support 'pipefail'
when running the default find command Close #3339 Close #3364
This commit is contained in:
parent
0130f64934
commit
547e101f1d
@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
@ -98,8 +99,17 @@ func (r *Reader) ReadSource() {
|
||||
r.startEventPoller()
|
||||
var success bool
|
||||
if util.IsTty() {
|
||||
// The default command for *nix requires bash
|
||||
// The default command for *nix requires a shell that supports "pipefail"
|
||||
// https://unix.stackexchange.com/a/654932/62171
|
||||
shell := "bash"
|
||||
currentShell := os.Getenv("SHELL")
|
||||
currentShellName := path.Base(currentShell)
|
||||
for _, shellName := range []string{"bash", "zsh", "ksh", "ash", "hush", "mksh", "yash"} {
|
||||
if currentShellName == shellName {
|
||||
shell = currentShell
|
||||
break
|
||||
}
|
||||
}
|
||||
cmd := os.Getenv("FZF_DEFAULT_COMMAND")
|
||||
if len(cmd) == 0 {
|
||||
if defaultCommand != "" {
|
||||
|
Loading…
Reference in New Issue
Block a user