Fix get_terminal_size over SSH

This commit is contained in:
Joshua Boniface 2023-12-06 13:11:28 -05:00
parent 2267a9c85d
commit 536fb2080f
1 changed files with 6 additions and 2 deletions

View File

@ -46,8 +46,12 @@ DEFAULT_API_PREFIX = "/api/v1"
DEFAULT_NODE_HOSTNAME = gethostname().split(".")[0]
DEFAULT_AUTOBACKUP_FILENAME = "/etc/pvc/pvc.conf"
# Define the content width to be the maximum temminal size
MAX_CONTENT_WIDTH = get_terminal_size().columns - 1
try:
# Define the content width to be the maximum terminal size
MAX_CONTENT_WIDTH = get_terminal_size().columns - 1
except OSError:
# Fall back to 80 columns if "Inappropriate ioctl for device"
MAX_CONTENT_WIDTH = 80
def echo(config, message, newline=True, stderr=False):