Skip to content
Myr

Use $SHELL to start $FZF_DEFAULT_COMMAND (#481)

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

authored by Junegunn Choi · committed by Junegunn Choi · parent 30bd0b5 · Browse files · 3 files+12 added−8 removed
This commit

State

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

Diff stats

3 files+12 added−8 removed

  • other:+12 added−8 removed

3 files+12 added−8 removed

modified:src/util/util.go+10 added
3 unmodified lines
4import "C"56import (7 "os"8 "os/exec"9 "time"10 "unicode/utf8"11)12
113 unmodified lines
126 }127 }128 return i - j + 1129}130131// ExecCommand executes the given command with $SHELL132func ExecCommand(command string) *exec.Cmd {133 shell := os.Getenv("SHELL")134 if len(shell) == 0 {135 shell = "sh"136 }137 return exec.Command(shell, "-c", command)138}
modified:src/reader.go+1 added-2 removed
2 unmodified lines
3import (4 "bufio"5 "io"6 "os"7 "os/exec"78 "github.com/junegunn/fzf/src/util"9)10
46 unmodified lines
57 r.feed(os.Stdin)58}5960func (r *Reader) readFromCommand(cmd string) {62 listCommand := exec.Command("sh", "-c", cmd)61 listCommand := util.ExecCommand(cmd)62 out, err := listCommand.StdoutPipe()63 if err != nil {64 return65 }
7 unmodified lines
modified:src/terminal.go+1 added-6 removed
2 unmodified lines
3import (4 "bytes"5 "fmt"6 "os"7 "os/exec"7 "os/signal"8 "regexp"9 "sort"10 "strconv"
707 unmodified lines
718}719720func executeCommand(template string, replacement string) {721 command := strings.Replace(template, "{}", replacement, -1)723 shell := os.Getenv("SHELL")724 if len(shell) == 0 {725 shell = "sh"726 }727 cmd := exec.Command(shell, "-c", command)722 cmd := util.ExecCommand(command)723 cmd.Stdin = os.Stdin724 cmd.Stdout = os.Stdout725 cmd.Stderr = os.Stderr726 C.Endwin()
447 unmodified lines