mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
LibLine: Change get_line to return a Result<String, Error>
This fixes a bunch of FIXME's in LibLine. Also handles the case where read() would read zero bytes in vt_dsr() and effectively block forever by erroring out. Fixes #2370
This commit is contained in:
parent
1e30ef239b
commit
bc9013f706
Notes:
sideshowbarker
2024-07-19 06:08:54 +09:00
Author: https://github.com/alimpfard
Commit: bc9013f706
Pull-request: https://github.com/SerenityOS/serenity/pull/2372
Issue: https://github.com/SerenityOS/serenity/issues/2370
Reviewed-by: https://github.com/bugaevc
7 changed files with 87 additions and 22 deletions
|
@ -113,7 +113,12 @@ int run(Function<void(const char*, size_t)> fn)
|
|||
Line::Editor editor;
|
||||
editor.initialize();
|
||||
for (;;) {
|
||||
auto line = editor.get_line("> ");
|
||||
auto line_result = editor.get_line("> ");
|
||||
|
||||
if (line_result.is_error())
|
||||
break;
|
||||
auto& line = line_result.value();
|
||||
|
||||
if (line == ".wait") {
|
||||
loop.exec();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue