display: use stdout for column width (#70199)

stdout may differ from stdin so it should be used to determine the column
width, especially since it is the target file descriptor.
pull/70070/head
Pavel Březina 4 years ago committed by GitHub
parent 3fe48ecba2
commit 45e0f74702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- Ansible output now uses stdout to determine column width instead of stdin

@ -530,8 +530,8 @@ class Display(with_metaclass(Singleton, object)):
return encoding
def _set_column_width(self):
if os.isatty(0):
tty_size = unpack('HHHH', fcntl.ioctl(0, TIOCGWINSZ, pack('HHHH', 0, 0, 0, 0)))[1]
if os.isatty(1):
tty_size = unpack('HHHH', fcntl.ioctl(1, TIOCGWINSZ, pack('HHHH', 0, 0, 0, 0)))[1]
else:
tty_size = 0
self.columns = max(79, tty_size - 1)

Loading…
Cancel
Save