Use $SHELL to start $FZF_DEFAULT_COMMAND (#481)

This commit is contained in:
Junegunn Choi
2016-02-07 01:49:29 +09:00
parent 30bd0b53db
commit e95d82748f
3 changed files with 12 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import "C"
import (
"os"
"os/exec"
"time"
"unicode/utf8"
)
@@ -126,3 +127,12 @@ func TrimLen(runes []rune) int {
}
return i - j + 1
}
// ExecCommand executes the given command with $SHELL
func ExecCommand(command string) *exec.Cmd {
shell := os.Getenv("SHELL")
if len(shell) == 0 {
shell = "sh"
}
return exec.Command(shell, "-c", command)
}