Resolve potential bug in MOTD in Docker (#2331)

* Resolve potential bug in MOTD in Docker
This commit is contained in:
Adam Hopkins 2021-12-03 13:27:16 +02:00 committed by GitHub
parent f641830d26
commit 19f6544923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,8 +64,10 @@ class MOTDTTY(MOTD):
self.set_variables() self.set_variables()
def set_variables(self): # no cov def set_variables(self): # no cov
fallback = (80, 24) fallback = (108, 24)
terminal_width = min(get_terminal_size(fallback=fallback).columns, 108) terminal_width = max(
get_terminal_size(fallback=fallback).columns, fallback[0]
)
self.max_value_width = terminal_width - fallback[0] + 36 self.max_value_width = terminal_width - fallback[0] + 36
self.key_width = 4 self.key_width = 4