MCPcopy Index your code
hub / github.com/perkeep/perkeep / cmdOutputDirErr

Function cmdOutputDirErr

dev/devcam/hook.go:277–289  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
277func 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}

Callers 2

hookTrailingSpaceMethod · 0.85
runGofmtMethod · 0.85

Calls 1

CommandMethod · 0.65

Tested by

no test coverage detected