open-consul/agent/util_other.go
2017-08-08 21:52:50 -07:00

18 lines
303 B
Go

// +build !windows
package agent
import (
"os"
"os/exec"
)
// ExecScript returns a command to execute a script
func ExecScript(script string) (*exec.Cmd, error) {
shell := "/bin/sh"
if other := os.Getenv("SHELL"); other != "" {
shell = other
}
return exec.Command(shell, "-c", script), nil
}