From e95d82748fc8fe5a05d93b30388ba37adb7dbac8 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 7 Feb 2016 01:49:29 +0900 Subject: Use $SHELL to start $FZF_DEFAULT_COMMAND (#481) --- src/util/util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/util') diff --git a/src/util/util.go b/src/util/util.go index e7e4f313..ab9e7664 100644 --- a/src/util/util.go +++ b/src/util/util.go @@ -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) +} -- cgit v1.2.3