2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-27 15:50:24 +00:00

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.
This commit is contained in:
Jarrod Johnson 2018-11-20 16:01:36 -05:00
parent aa92898249
commit 9f137fa6d4

View File

@ -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())