MCPcopy Create free account
hub / github.com/dirk/quickhook / runExecutable

Function runExecutable

hooks/executable.go:16–32  ·  view source on GitHub ↗
(root, executable string, env []string, stdin string, arg ...string)

Source from the content-addressed store, hash-verified

14)
15
16func runExecutable(root, executable string, env []string, stdin string, arg ...string) hookResult {
17 dir, command := path.Split(executable)
18 span := tracing.NewSpan(fmt.Sprintf("hook %s %s", path.Base(dir), command))
19 defer span.End()
20 cmd := exec.Command(path.Join(root, executable), arg...)
21 cmd.Env = append(os.Environ(), env...)
22 cmd.Stdin = strings.NewReader(stdin)
23 var stderr bytes.Buffer
24 cmd.Stderr = &stderr
25 stdout, err := cmd.Output()
26 return hookResult{
27 executable: executable,
28 stdout: string(stdout),
29 stderr: stderr.String(),
30 err: err,
31 }
32}
33
34type hookResult struct {
35 executable string

Callers 2

RunMethod · 0.85
RunMethod · 0.85

Calls 2

EndMethod · 0.95
NewSpanFunction · 0.92

Tested by

no test coverage detected