You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know why my PR #2916 didn't get any response and was finally closed. Anyway, I'm opening this issue to restate the bug.
Currently, the automatic detection of terminal size on Windows is only performed for _STDOUT_FILENO which is the default value passed to os.get_terminal_size. So if we redirect the standard output (stdout) to a file and create a Console on the standard error (stderr) with width and height left None, the auto-detected terminal size will always be a fallback value (80, 25) (supposing that legacy_windows is False).
A simple example to illustrate this problem: on Windows, run the following test script with stdout redirected to a file, while stderr was still connected to a terminal, e.g., with width = 140 and height = 21:
Describe the bug
I don't know why my PR #2916 didn't get any response and was finally closed. Anyway, I'm opening this issue to restate the bug.
Currently, the automatic detection of terminal size on Windows is only performed for
_STDOUT_FILENO
which is the default value passed toos.get_terminal_size
. So if we redirect the standard output (stdout
) to a file and create aConsole
on the standard error (stderr
) withwidth
andheight
leftNone
, the auto-detected terminal size will always be a fallback value(80, 25)
(supposing thatlegacy_windows
isFalse
).A simple example to illustrate this problem: on Windows, run the following test script with
stdout
redirected to a file, whilestderr
was still connected to a terminal, e.g., with width = 140 and height = 21:The output is
which is not the expected:
However, this works as expected On Linux.
Platform
Click to expand
The output of
python -m rich.diagnose
(tested in Rich v13.7.1):The text was updated successfully, but these errors were encountered: