From 04395f909b0871f97106550e19c6c3618211bfd8 Mon Sep 17 00:00:00 2001 From: Angel Misevski Date: Thu, 23 Nov 2023 14:15:35 -0500 Subject: [PATCH] Initialize terminal pty with initial size set When creating a terminal, queue the initial size of the terminal in the resize channel to ensure the terminal has correct dimensions upon opening. Signed-off-by: Angel Misevski --- exec/kubernetes_exec_manager.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exec/kubernetes_exec_manager.go b/exec/kubernetes_exec_manager.go index 022699659..32af5904c 100644 --- a/exec/kubernetes_exec_manager.go +++ b/exec/kubernetes_exec_manager.go @@ -236,11 +236,13 @@ func (manager *KubernetesExecManager) doCreate(machineExec *model.MachineExec, c machineExec.Executor = executor machineExec.ID = int(atomic.AddUint64(&prevExecID, 1)) machineExec.MsgChan = make(chan []byte) - machineExec.SizeChan = make(chan remotecommand.TerminalSize) + machineExec.SizeChan = make(chan remotecommand.TerminalSize, 1) machineExec.ExitChan = make(chan bool) machineExec.ErrorChan = make(chan error) machineExec.ConnectionHandler = ws.NewConnHandler() + machineExec.SizeChan <- remotecommand.TerminalSize{Width: uint16(machineExec.Cols), Height: uint16(machineExec.Rows)} + execs.execMap[machineExec.ID] = machineExec return nil