MCPcopy
hub / github.com/mislav/hub / Exec

Method Exec

cmd/cmd.go:107–122  ·  view source on GitHub ↗

Exec runs command with exec(3) Note that Windows doesn't support exec(3): http://golang.org/src/pkg/syscall/exec_windows.go#L339

()

Source from the content-addressed store, hash-verified

105// Exec runs command with exec(3)
106// Note that Windows doesn't support exec(3): http://golang.org/src/pkg/syscall/exec_windows.go#L339
107func (cmd *Cmd) Exec() error {
108 verboseLog(cmd)
109
110 binary, err := exec.LookPath(cmd.Name)
111 if err != nil {
112 return &exec.Error{
113 Name: cmd.Name,
114 Err: fmt.Errorf("command not found"),
115 }
116 }
117
118 args := []string{binary}
119 args = append(args, cmd.Args...)
120
121 return syscall.Exec(binary, args, os.Environ())
122}
123
124func New(name string) *Cmd {
125 return &Cmd{

Callers 1

RunMethod · 0.95

Calls 2

verboseLogFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected