From: AlanKingPL Date: Wed, 8 Jul 2026 11:13:40 +0000 (+0200) Subject: terminal: Enhance terminal size detection for multiple outputs X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=20c7877dcb0aba0a198ea3e66b29f72cc5e8de85;p=thirdparty%2Fcurl.git terminal: Enhance terminal size detection for multiple outputs - Get the terminal size from STDOUT or STDERR when the terminal size of STDIN is not available. Closes https://github.com/curl/curl/pull/22276 --- diff --git a/src/terminal.c b/src/terminal.c index b25c0e6e80..2e28d92323 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -62,6 +62,10 @@ unsigned int get_terminal_columns(void) struct winsize ts; if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts)) cols = (int)ts.ws_col; + else if(!ioctl(STDOUT_FILENO, TIOCGWINSZ, &ts)) + cols = (int)ts.ws_col; + else if(!ioctl(STDERR_FILENO, TIOCGWINSZ, &ts)) + cols = (int)ts.ws_col; #elif defined(_WIN32) && !defined(CURL_WINDOWS_UWP) { HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE);