mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Shell: Don't crash when stdout is not a TTY
Let's just pretend we have 80 columns while running non-interactively. There are definitely nicer solutions here, and we should find them.
This commit is contained in:
parent
6eab7b398d
commit
6ca1a46afd
Notes:
sideshowbarker
2024-07-19 09:57:32 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6ca1a46afd9
1 changed files with 4 additions and 3 deletions
|
@ -34,9 +34,10 @@
|
|||
LineEditor::LineEditor()
|
||||
{
|
||||
struct winsize ws;
|
||||
int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws);
|
||||
ASSERT(rc == 0);
|
||||
m_num_columns = ws.ws_col;
|
||||
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
|
||||
m_num_columns = 80;
|
||||
else
|
||||
m_num_columns = ws.ws_col;
|
||||
}
|
||||
|
||||
LineEditor::~LineEditor()
|
||||
|
|
Loading…
Reference in a new issue