MCPcopy Create free account
hub / github.com/cli/cli / ghVersion

Function ghVersion

script/ghmock/run.go:582–594  ·  view source on GitHub ↗
(path string, env []string, dir string)

Source from the content-addressed store, hash-verified

580}
581
582func ghVersion(path string, env []string, dir string) string {
583 ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
584 defer cancel()
585 cmd := exec.CommandContext(ctx, path, "--version")
586 cmd.Env = env
587 cmd.Dir = dir
588 out, err := cmd.Output()
589 if err != nil {
590 return "unknown version"
591 }
592 line, _, _ := strings.Cut(strings.TrimSpace(string(out)), "\n")
593 return strings.TrimSpace(line)
594}
595
596func newRunID(start time.Time) string {
597 var b [3]byte

Callers 1

runBinaryFunction · 0.85

Calls 1

OutputMethod · 0.65

Tested by

no test coverage detected