cmdOutputDirErr runs the command line in dir, returning its output and any error results. NOTE: cmdOutputDirErr must be used only to run commands that read state, not for commands that make changes. Commands that make changes should be run using runDirErr so that the -v and -n flags apply to them.
(dir, command string, args ...string)
| 275 | // not for commands that make changes. Commands that make changes |
| 276 | // should be run using runDirErr so that the -v and -n flags apply to them. |
| 277 | func cmdOutputDirErr(dir, command string, args ...string) (string, error) { |
| 278 | // NOTE: We only show these non-state-modifying commands with -v -v. |
| 279 | // Otherwise things like 'git sync -v' show all our internal "find out about |
| 280 | // the git repo" commands, which is confusing if you are just trying to find |
| 281 | // out what git sync means. |
| 282 | |
| 283 | cmd := exec.Command(command, args...) |
| 284 | if dir != "." { |
| 285 | cmd.Dir = dir |
| 286 | } |
| 287 | b, err := cmd.CombinedOutput() |
| 288 | return string(b), err |
| 289 | } |
no test coverage detected