diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/util.go | 10 |
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) +} |