Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read error: 0: Resource temporarily unavailable when querying user for branch name #38

Closed
rorybyrne opened this issue Aug 11, 2024 · 5 comments · Fixed by #39 or #40
Closed

read error: 0: Resource temporarily unavailable when querying user for branch name #38

rorybyrne opened this issue Aug 11, 2024 · 5 comments · Fixed by #39 or #40

Comments

@rorybyrne
Copy link

gh-fzf/gh-fzf

Lines 866 to 875 in 510181c

branch_prompt() {
[ -z "$1" ] && error "missing argument." \
"Usage: gh fzf util branch-prompt <issue-number>"
issue="${GH_FZF_BRANCH_ADD_ISSUE_NUMBER:+${1}$GH_FZF_BRANCH_ADD_ISSUE_NUMBER}"
sanitized_issue=$(tr -d "#'\''" <<<"${issue// /}")
read -rp "Enter branch name for ${1}: ${GH_FZF_BRANCH_PREFIX}${sanitized_issue}" name
echo "${GH_FZF_BRANCH_PREFIX}${sanitized_issue}${name// /-}"
}

Line 873 produces the following error when I run gh fzf i and then alt-o. This happens on MacOS using Tabby terminal and zsh.

➜  my_project git:(main) gh fzf i                                                
Enter branch name for #9: /Users/rory/.local/share/gh/extensions/gh-fzf/gh-fzf: line 873: read: read error: 0: Resource temporarily unavailable

Versions:

➜  my_project git:(main) gh --version
gh version 2.53.0 (2024-07-17)
https://github.com/cli/cli/releases/tag/v2.53.0
➜  my_project git:(main) gh fzf --version
v0.14.0
➜  my_project git:(main) zsh --version
zsh 5.9 (arm64-apple-darwin24.0)
@benelan
Copy link
Owner

benelan commented Aug 21, 2024

Thanks for the bug report! I can't reproduce on Ubuntu and Bash, but I'll try to investigate.

Does the error occur before the prompt is displayed or after you enter a branch name and press enter? Also, which version of fzf do you have installed?

@benelan
Copy link
Owner

benelan commented Aug 21, 2024

It looks like fzf versions prior to 0.53.0 required manual /dev/tty redirection when interactive programs are used in execute actions. If your fzf version is less than 0.53.0, can you try the fix on benelan/38-read-error and let me know if it resolves your error? Thanks!

curl https://raw.githubusercontent.com/benelan/gh-fzf/benelan/38-read-error/gh-fzf > ~/.local/share/gh/extensions/gh-fzf/gh-fzf

@rorybyrne
Copy link
Author

rorybyrne commented Aug 21, 2024

@benelan that worked - thank you! For context, the error was after pressing option-o (MacOS).

image

@rorybyrne
Copy link
Author

Also my fzf is at 0.54.3.

@benelan benelan linked a pull request Aug 21, 2024 that will close this issue
benelan added a commit that referenced this issue Aug 21, 2024
🤖 I have created a release *beep* *boop*
---


## [0.14.1](v0.14.0...v0.14.1)
(2024-08-21)


### Bug Fixes

* **issue, label, milestone:** Add manual `/dev/tty` redirection to
prevent `read` error during user input prompts
([#39](#39))
([4e2ba98](4e2ba98)),
closes [#38](#38)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben Elan <[email protected]>
@benelan
Copy link
Owner

benelan commented Aug 21, 2024

Also my fzf is at 0.54.3.

Interesting, it must be something related to zsh or Mac then. I fixed all of the issues related to read, but there may be other tty problems that I don't reproduce on my end either. If you find one, please log another issue and I'll get it fixed. Thanks again for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants