cli / cli/cli

`gh pr list` doesn't write output anywhere if stdout or stderr is piped

Open
#9,152 22 comments 1 reaction 0 assignees View on GitHub
bug gh-pr needs-triage
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Describe the bug

When you pipe the stdout or stderr of `gh` somewhere, it no longer writes useful output to the stderr.

### Steps to reproduce the behavior

```console
❯ gh pr list
X No default remote repository has been set for this directory.

please run `gh repo set-default` to select a default remote repository.

❯ gh pr list | cat


```

Using latest brew gh version:

```console
❯ gh --version
gh version 2.50.0 (2024-05-29)
https://github.com/cli/cli/releases/tag/v2.50.0
```

### Expected vs actual behavior

I expect to see the error on the stderr even when I save the output on the stdout.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.