1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:57:47 +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:
Andreas Kling 2020-01-19 13:51:43 +01:00
parent 6eab7b398d
commit 6ca1a46afd

View file

@ -34,8 +34,9 @@
LineEditor::LineEditor() LineEditor::LineEditor()
{ {
struct winsize ws; struct winsize ws;
int rc = ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0)
ASSERT(rc == 0); m_num_columns = 80;
else
m_num_columns = ws.ws_col; m_num_columns = ws.ws_col;
} }