gh pr list
stderr is not captured by subprocess. I am not sure github cli gh has a special implementation of stderr.
(base) root@ip-172-26-1-210:# python -c "import subprocess;print(subprocess.run('gh pr list', shell=True, capture_output=True))"
CompletedProcess(args='gh pr list', returncode=0, stdout=b'', stderr=b'')
(base) root@ip-172-26-1-210:~/github# python --version
Python 3.10.10
(base) root@ip-172-26-1-210:~/github# gh pr list
no open pull requests in peterjpxie/github
(base) root@ip-172-26-1-210:~/github# gh pr list 2>a.txt
(base) root@ip-172-26-1-210:~/github# cat a.txt
no open pull requests in peterjpxie/github
Environment:
Ubuntu 20.04
Miniconda base env: Python 3.10.10