mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibLine: Quit event loop when an error occurs on update
Previously we were crashing, which was excessive, if we can't read anymore, we should just return with an error.
This commit is contained in:
parent
ce6636e78e
commit
c045d09840
Notes:
sideshowbarker
2024-07-17 00:57:58 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/c045d09840 Pull-request: https://github.com/SerenityOS/serenity/pull/17259
1 changed files with 11 additions and 3 deletions
|
@ -749,9 +749,17 @@ auto Editor::get_line(DeprecatedString const& prompt) -> Result<DeprecatedString
|
|||
|
||||
m_notifier = Core::Notifier::construct(STDIN_FILENO, Core::Notifier::Read);
|
||||
|
||||
m_notifier->on_ready_to_read = [&] { try_update_once().release_value_but_fixme_should_propagate_errors(); };
|
||||
if (!m_incomplete_data.is_empty())
|
||||
deferred_invoke([&] { try_update_once().release_value_but_fixme_should_propagate_errors(); });
|
||||
m_notifier->on_ready_to_read = [&] {
|
||||
if (try_update_once().is_error())
|
||||
loop.quit(Exit);
|
||||
};
|
||||
|
||||
if (!m_incomplete_data.is_empty()) {
|
||||
deferred_invoke([&] {
|
||||
if (try_update_once().is_error())
|
||||
loop.quit(Exit);
|
||||
});
|
||||
}
|
||||
|
||||
if (loop.exec() == Retry)
|
||||
return get_line(prompt);
|
||||
|
|
Loading…
Reference in a new issue