cli: Can't create PRs from screen sessions

Describe the bug

gh pr create --draft exits with EOF on the “where should we push” prompt when run on Linux with TERM=screen or screen.xterm-256color, but not with xterm-256color

gh --version: gh version 2.2.0 (2021-10-25)

Steps to reproduce the behavior

  1. Install screen
  2. Start a session from gnome-terminal so the terminal inside the screen has TERM=screen.xterm-256color
  3. Create a local branch in a repo and commit something, but don’t push it
  4. Run gh pr create --draft

Expected vs actual behavior

Expected: Should allow me to answer the “Where should we push …” prompt normally

Actual: Prints the prompt, then immediately prints an EOF error and exits.

Sometimes gets worse: occasionally spews garbage into my terminal input stream – as if it sent some “please send me back the X info” to the terminal, and then exited before it go the reply, and so the terminal ends up sending that to my shell. The “garbage” in this case is a mix of alpha-numerics and colons/semicolons I think (don’t have one handy however, will update if/when I get one)

Logs

~/src/repo$ gh pr create --draft
? Where should we push the 'censored' branch?  [Use arrows to move, type to filter]
> org/repo
  Create a fork of org/repo
  Skip pushing the branch
  Cancel
EOF

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

@mgabeler-lee-6rs Thank you for the update and for the upstream fix! I’ve merged the Survey upgrade to trunk https://github.com/cli/cli/pull/5337 and will now close this since the fix will ship in the next release.

After a deeeeep dive, I figured out the problem in the survey library. Issue is here, will be submitting a PR to fix it in that library shortly: https://github.com/AlecAivazis/survey/issues/408

Edit: PR with fix: https://github.com/AlecAivazis/survey/pull/409

I recently got this issue when I want to create a repository. Restarting the terminal fixes this problem.