summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2016-02-07 01:49:29 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2016-02-07 01:49:29 +0900
commite95d82748fc8fe5a05d93b30388ba37adb7dbac8 (patch)
treed59019cea080cd5c5afb6864ae5c55832d0b4285 /src/util
parent30bd0b53dbf804a96db4c13d787771b3924d6634 (diff)
Use $SHELL to start $FZF_DEFAULT_COMMAND (#481)
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util.go10
1 files changed, 10 insertions, 0 deletions
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)
+}