2019-10-23 23:57:17 -04:00
|
|
|
package common
|
2013-09-30 12:33:57 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
)
|
|
|
|
|
|
|
|
// CommandWrapper is a type that given a command, will possibly modify that
|
|
|
|
// command in-flight. This might return an error.
|
|
|
|
type CommandWrapper func(string) (string, error)
|
|
|
|
|
|
|
|
// ShellCommand takes a command string and returns an *exec.Cmd to execute
|
|
|
|
// it within the context of a shell (/bin/sh).
|
|
|
|
func ShellCommand(command string) *exec.Cmd {
|
|
|
|
return exec.Command("/bin/sh", "-c", command)
|
|
|
|
}
|