mirror of
https://github.com/curl/curl.git
synced 2026-07-28 18:13:06 +03:00
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
This commit is contained in:
parent
a479459ea3
commit
20c7877dcb
1 changed files with 4 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue