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

Function isUnderHomebrew

internal/ghcmd/cmd.go:348–361  ·  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

346
347// Check whether the gh binary was found under the Homebrew prefix
348func isUnderHomebrew(ghBinary string) bool {
349 brewExe, err := safeexec.LookPath("brew")
350 if err != nil {
351 return false
352 }
353
354 brewPrefixBytes, err := exec.Command(brewExe, "--prefix").Output()
355 if err != nil {
356 return false
357 }
358
359 brewBinPrefix := filepath.Join(strings.TrimSpace(string(brewPrefixBytes)), "bin") + string(filepath.Separator)
360 return strings.HasPrefix(ghBinary, brewBinPrefix)
361}
362
363func newIOStreams(cfg gh.Config, invokingAgent agents.AgentName) *iostreams.IOStreams {
364 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