LibLine: Handle any errors propagated through refresh_display()

This can only realistically happen when the terminal no longer exists,
so quitting with an error here is the better solution as the application
will soon be killed anyway.
Fixes #19742.
Fixes #19017.
This commit is contained in:
Ali Mohammad Pur 2023-07-02 13:44:42 +03:30 committed by Ali Mohammad Pur
parent b26dad3d62
commit e1e04884b9
Notes: sideshowbarker 2024-07-17 05:03:11 +09:00

View file

@ -759,12 +759,16 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString
m_history_cursor = m_history.size();
refresh_display().release_value_but_fixme_should_propagate_errors();
if (auto refresh_result = refresh_display(); refresh_result.is_error())
m_input_error = Error::ReadFailure;
Core::EventLoop loop;
m_notifier = Core::Notifier::construct(STDIN_FILENO, Core::Notifier::Type::Read);
if (m_input_error.has_value())
loop.quit(Exit);
m_notifier->on_activation = [&] {
if (try_update_once().is_error())
loop.quit(Exit);