diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2017-09-28 23:05:02 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2017-09-28 23:05:02 +0900 |
| commit | ee40212e9772941b49a4bdb1e95f99913cdea469 (patch) | |
| tree | 799667bda43ca07dbb33b3992f10ba6ea608062e /src/reader.go | |
| parent | 7f5f6efbac677603181434193abbb2a8d550b8b5 (diff) | |
| download | fzf-ee40212e9772941b49a4bdb1e95f99913cdea469.tar.gz | |
Update FZF_DEFAULT_COMMAND
- Use bash for `set -o pipefail`
- Fall back to simpler find command when the original command failed
Related: #1061
Diffstat (limited to 'src/reader.go')
| -rw-r--r-- | src/reader.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/reader.go b/src/reader.go index 22ce4ba0..5fd6d876 100644 --- a/src/reader.go +++ b/src/reader.go @@ -56,9 +56,11 @@ func (r *Reader) ReadSource() { if util.IsTty() { cmd := os.Getenv("FZF_DEFAULT_COMMAND") if len(cmd) == 0 { - cmd = defaultCommand + // The default command for *nix requires bash + success = r.readFromCommand("bash", defaultCommand) + } else { + success = r.readFromCommand("sh", cmd) } - success = r.readFromCommand(cmd) } else { success = r.readFromStdin() } @@ -100,8 +102,8 @@ func (r *Reader) readFromStdin() bool { return true } -func (r *Reader) readFromCommand(cmd string) bool { - listCommand := util.ExecCommand(cmd) +func (r *Reader) readFromCommand(shell string, cmd string) bool { + listCommand := util.ExecCommandWith(shell, cmd) out, err := listCommand.StdoutPipe() if err != nil { return false |
