Check whether the gh binary was found under the Homebrew prefix
(ghBinary string)
| 346 | |
| 347 | // Check whether the gh binary was found under the Homebrew prefix |
| 348 | func 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 | |
| 363 | func newIOStreams(cfg gh.Config, invokingAgent agents.AgentName) *iostreams.IOStreams { |
| 364 | io := iostreams.System() |