* Adam Borowski <kilob...@angband.pl>, 2021-10-12, 22:09:
Some programs are very confused about the terminal width when run
under pipetty, e.g.:
[...]
Apparently this is because pipetty never sets windows size, so the
size is reported as 0:
$ strace -f -o '|grep -w TIOCGWINSZ >&2' pipetty gallery-dl --help >/dev/null
9222 ioctl(1, TIOCGWINSZ, {ws_row=0, ws_col=0, ws_xpixel=0, ws_ypixel=0}) = 0
9222 ioctl(1, TIOCGWINSZ, {ws_row=0, ws_col=0, ws_xpixel=0, ws_ypixel=0}) = 0
Yeah, that's because in the usual use case there is no outside
terminal. Passing the size of the terminal if there's one would be
probably be a bad idea as it'd change the behaviour during testing vs
real use.
One option would be providing a bogus size (such as 80x24 as getty on
serial does). I'm not sure, though, if it'd do more or less harm than
not providing a size at all.
On the other hand, lesstty in any non-erroneous case will be invoked
from a terminal -- I've thus just changed it to pass the size.
What would be your advice about what data to provide for pipetty?
I'm not sure either.
I needed this for my own lesstty-like program. But in the mean time, I
figured out I can easily set the terminal size myself:
https://github.com/jwilk/pagerboy/commit/375bbbcdc3550483
Feel free to close the bug.
--
Jakub Wilk