Exec runs command with exec(3) Note that Windows doesn't support exec(3): http://golang.org/src/pkg/syscall/exec_windows.go#L339
()
| 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 |
| 107 | func (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 | |
| 124 | func New(name string) *Cmd { |
| 125 | return &Cmd{ |
no test coverage detected