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

fix: do not send data to closed stream #2746

Merged
merged 1 commit into from
Oct 23, 2023
Merged

fix: do not send data to closed stream #2746

merged 1 commit into from
Oct 23, 2023

Conversation

frantisekstanko
Copy link
Contributor

@frantisekstanko frantisekstanko commented Oct 18, 2023

Description

This pull request fixes the following error:

E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'

This error can be triggered using new_termopen_previewer(), in case its get_command() ends without pagination (full code) and then attempting to scroll down in the previewer.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • manual test: run telescope with new_termopen_previewer and get_command which returns a non-paginated output and attempt to scroll down

Configuration:

  • Neovim version (nvim --version): 0.9.4
  • Operating system and version: OpenSUSE Tumbleweed 20231017

My full telescope config

Checklist:

  • My code follows the style guidelines of this project (stylua)
  • I have performed a self-review of my own code

This commit fixes the following error:

E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'

This happens when previewers.new_termopen_previewer()'s get_command()
ends without pagination.
@Conni2461
Copy link
Member

Good catch, thanks :)

@Conni2461 Conni2461 merged commit a62db88 into nvim-telescope:master Oct 23, 2023
6 checks passed
@frantisekstanko frantisekstanko deleted the closed-stream-fix branch October 23, 2023 08:07
rameshsanth pushed a commit to rameshsanth/telescope.nvim that referenced this pull request Nov 17, 2023
This commit fixes the following error:

E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'

This happens when previewers.new_termopen_previewer()'s get_command()
ends without pagination.
Conni2461 pushed a commit that referenced this pull request Nov 28, 2023
This commit fixes the following error:

E5108: Error executing lua: Vim:Can't send data to closed stream
stack traceback:
[C]: in function 'chansend'
/lua/telescope/previewers/term_previewer.lua:224: in function '_send_input'
/lua/telescope/previewers/previewer.lua:85: in function 'send_input'
/lua/telescope/previewers/term_previewer.lua:238: in function '_scroll_fn'
/lua/telescope/previewers/previewer.lua:93: in function 'scroll_fn'
/lua/telescope/actions/set.lua:249: in function 'run_replace_or_original'
/lua/telescope/actions/mt.lua:65: in function 'scroll_previewer'
/lua/telescope/actions/init.lua:222: in function 'run_replace_or_original'

This happens when previewers.new_termopen_previewer()'s get_command()
ends without pagination.

(cherry picked from commit a62db88)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants