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'm trying to read the size of the terminal attached to stderr while stdout is redirected to a file.
/path/to/program > out.txt
let term = Term::buffered_stderr();
let size = term.size();
The above code is returning the default terminal size, since terminal_size is calling the isatty on STDOUT_FILENO and returning None. (see unix_term.rs:49)
This is likely a simple fix: Use the raw file descriptor from the Term when checking isatty, instead of hard coding STDOUT_FILENO.
The text was updated successfully, but these errors were encountered:
As weird as it sounds this was done intentional. I think it requires some rethinking but it's not uncommon that only stdout is connected to a terminal and then the call fails for no reason. Maybe a better solution would be to check either handle? I'm not sure.
I'm trying to read the size of the terminal attached to stderr while stdout is redirected to a file.
The above code is returning the default terminal size, since
terminal_size
is calling theisatty
onSTDOUT_FILENO
and returningNone
. (seeunix_term.rs:49
)This is likely a simple fix: Use the raw file descriptor from the Term when checking
isatty
, instead of hard codingSTDOUT_FILENO
.The text was updated successfully, but these errors were encountered: