From 9f137fa6d4dbdb0e19888afe92cff846e9f9ca2f Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 20 Nov 2018 16:01:36 -0500 Subject: [PATCH] Begin work to send resize to remote While we do not have a path forward for auto-resize in SOL consoles, we can provide the capability for ssh consoles. The CLI being enabled is of course nice, but running ssh directly is still suggested in such a context and ultimately the Web GUI will be the most prominent consumer of the information. --- confluent_client/bin/confetty | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/confluent_client/bin/confetty b/confluent_client/bin/confetty index a321a141..e79b121b 100755 --- a/confluent_client/bin/confetty +++ b/confluent_client/bin/confetty @@ -49,6 +49,7 @@ import select import shlex import signal import socket +import struct import sys import time try: @@ -576,11 +577,18 @@ def fullpath_target(currpath, forcepath=False): ntarget += '/' return ntarget +def do_resize(a, b): + if not inconsole: + return + height, width = struct.unpack( + 'hh', fcntl.ioctl(sys.stdout, termios.TIOCGWINSZ, b'....'))[:2] + def startconsole(nodename): global inconsole global consolename global didconsole + signal.signal(signal.SIGWINCH, do_resize) didconsole = True consolename = nodename tty.setraw(sys.stdin.fileno())