mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
AK: Make vout() log to debug instead of VERIFY()'ing
In case the write was to stderr/stdout, and it just so happened to fail because of an issue like "the pty is gone", VERIFY() would end up calling vout() back to write to stderr, which would then fail forever until the stack is exhausted. "Fixes" the issue where the Shell would crash in horrible ways when the terminal is closed.
This commit is contained in:
parent
ed1800547e
commit
73cb566041
Notes:
sideshowbarker
2024-07-18 17:47:22 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/73cb5660419 Pull-request: https://github.com/SerenityOS/serenity/pull/7272
1 changed files with 5 additions and 1 deletions
|
@ -20,6 +20,7 @@
|
|||
# include <Kernel/Thread.h>
|
||||
#else
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
||||
namespace AK {
|
||||
|
@ -608,7 +609,10 @@ void vout(FILE* file, StringView fmtstr, TypeErasedFormatParams params, bool new
|
|||
|
||||
const auto string = builder.string_view();
|
||||
const auto retval = ::fwrite(string.characters_without_null_termination(), 1, string.length(), file);
|
||||
VERIFY(static_cast<size_t>(retval) == string.length());
|
||||
if (static_cast<size_t>(retval) != string.length()) {
|
||||
auto error = ferror(file);
|
||||
dbgln("vout() failed ({} written out of {}), error was {} ({})", retval, string.length(), error, strerror(error));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue