From f65cedb4de698cdecf67263194ee33ebccd984d4 Mon Sep 17 00:00:00 2001 From: spikeyspik <24636111+spikeyspik@users.noreply.github.com> Date: Fri, 24 Oct 2025 21:30:07 +0300 Subject: [PATCH] Fix: fallback to default terminal size on no tty --- src/main.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index 37471c1..06ac723 100644 --- a/src/main.c +++ b/src/main.c @@ -697,8 +697,13 @@ void print_progress_bar(double percent, char *suffix) buf[0] = '\0'; - if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0) - return; /* XXX */ + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) < 0 || ws.ws_col == 0) { + + // fallback to default + ws.ws_col = 80; + ws.ws_row = 24; + } + bar_width = min(sizeof(buf), ws.ws_col) - strlen(suffix) - 7; memset(buf, 0, sizeof(buf));