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