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

Function isUnderHomebrew

internal/ghcmd/cmd.go:375–388  ·  view source on GitHub ↗

Check whether the gh binary was found under the Homebrew prefix

(ghBinary string)

Source from the content-addressed store, hash-verified

373
374// Check whether the gh binary was found under the Homebrew prefix
375func isUnderHomebrew(ghBinary string) bool {
376 brewExe, err := safeexec.LookPath("brew")
377 if err != nil {
378 return false
379 }
380
381 brewPrefixBytes, err := exec.Command(brewExe, "--prefix").Output()
382 if err != nil {
383 return false
384 }
385
386 brewBinPrefix := filepath.Join(strings.TrimSpace(string(brewPrefixBytes)), "bin") + string(filepath.Separator)
387 return strings.HasPrefix(ghBinary, brewBinPrefix)
388}
389
390func newIOStreams(cfg gh.Config, invokingAgent agents.AgentName) *iostreams.IOStreams {
391 io := iostreams.System()

Callers 1

MainFunction · 0.85

Calls 3

CommandMethod · 0.80
JoinMethod · 0.80
OutputMethod · 0.65

Tested by

no test coverage detected