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

Continue processing even if terminfo database couldn't be found #673

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

ima1zumi
Copy link
Member

@ima1zumi ima1zumi commented Apr 5, 2024

Fix #447 #543

This problem occurs when Fiddle can be loaded, curses can be loaded, and TERM is not registered in Terminfo.
It should also occur at hardcopy terminals and when Terminfo information is low, but no such reports have been received.

Reline should not abort the process because of missing Terminfo.
Reline proceeds with Reline::Terminfo.enabled? == false when fiddle or curses cannot be loaded.
And does the same when Terminfo is present but TERM is not.

module Reline::Terminfo
def self.enabled?
false
end
end unless Reline::Terminfo.curses_dl

You can check the operation with TERM=foo bundle exec bin/console.

ref: man 3x curs_terminfo

@ima1zumi ima1zumi added the bug Something isn't working label Apr 5, 2024
@ima1zumi ima1zumi marked this pull request as draft April 5, 2024 16:52
@ima1zumi ima1zumi force-pushed the not-raise-terminfoerror branch 4 times, most recently from 462d82c to 31479e2 Compare April 5, 2024 17:24
@ima1zumi ima1zumi changed the title If terminfo could not be found, set Reline::Terminfo.enabled == false Continue processing even if terminfo database couldn't be found Apr 5, 2024
@ima1zumi ima1zumi marked this pull request as ready for review April 5, 2024 17:34
def self.enabled?
true
end

def self.supported?
Copy link
Member

@tompng tompng Apr 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name supported? is not clear what is supported.
Terminfo.enabled?: terminfo is enabled
Terminfo.supported?: TERM specified by ENV is supported in terminfo
How about term_supported?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I updated the code as suggested.

Fix ruby#447 ruby#543

This problem occurs when Fiddle can be loaded, curses can be loaded, and TERM is not registered in Terminfo.
It should also occur at hardcopy terminals and when Terminfo information is low, but no such reports have been received.

Reline should not abort the process because of missing Terminfo.
Reline proceeds with `Reline::Terminfo.enabled? == false` when fiddle or curses cannot be loaded.
And does the same when Terminfo is present but TERM is not.
https://github.com/ruby/reline/blob/ebab2875f1226f877376558d8758bc0e2a1776c7/lib/reline/terminfo.rb#L156-L160

You can check the operation with `TERM=foo bundle exec bin/console`.
@ima1zumi ima1zumi merged commit 4ce247c into ruby:master Apr 6, 2024
40 checks passed
matzbot pushed a commit to ruby/ruby that referenced this pull request Apr 6, 2024
be found
(ruby/reline#673)

Fix ruby/reline#447 ruby/reline#543

This problem occurs when Fiddle can be loaded, curses can be loaded, and TERM is not registered in Terminfo.
It should also occur at hardcopy terminals and when Terminfo information is low, but no such reports have been received.

Reline should not abort the process because of missing Terminfo.
Reline proceeds with `Reline::Terminfo.enabled? == false` when fiddle or curses cannot be loaded.
And does the same when Terminfo is present but TERM is not.
https://github.com/ruby/reline/blob/ebab2875f1226f877376558d8758bc0e2a1776c7/lib/reline/terminfo.rb#L156-L160

You can check the operation with `TERM=foo bundle exec bin/console`.

ruby/reline@4ce247ce2b
@ima1zumi ima1zumi deleted the not-raise-terminfoerror branch April 6, 2024 09:27
@ima1zumi ima1zumi mentioned this pull request Apr 6, 2024
artur-intech pushed a commit to artur-intech/ruby that referenced this pull request Apr 26, 2024
be found
(ruby/reline#673)

Fix ruby/reline#447 ruby/reline#543

This problem occurs when Fiddle can be loaded, curses can be loaded, and TERM is not registered in Terminfo.
It should also occur at hardcopy terminals and when Terminfo information is low, but no such reports have been received.

Reline should not abort the process because of missing Terminfo.
Reline proceeds with `Reline::Terminfo.enabled? == false` when fiddle or curses cannot be loaded.
And does the same when Terminfo is present but TERM is not.
https://github.com/ruby/reline/blob/ebab2875f1226f877376558d8758bc0e2a1776c7/lib/reline/terminfo.rb#L156-L160

You can check the operation with `TERM=foo bundle exec bin/console`.

ruby/reline@4ce247ce2b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

Reline::Terminfo::TerminfoError error with Overmind
2 participants