mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
b26dad3d62
commit
e1e04884b9
Notes:
sideshowbarker
2024-07-17 05:03:11 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/e1e04884b9 Pull-request: https://github.com/SerenityOS/serenity/pull/19749 Issue: https://github.com/SerenityOS/serenity/issues/19017 Issue: https://github.com/SerenityOS/serenity/issues/19742
1 changed files with 5 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue