revert: remove SIGWINCH signal that caused connection loops

Sending SIGWINCH to the docker exec process was crashing/killing it,
which closed the PTY and caused WebSocket 1006 abnormal closure loops.
Reverting to the original TIOCSWINSZ-only approach.
This commit is contained in:
Fusion
2026-05-24 16:00:25 +02:00
parent 0dba13a354
commit f6fb984ec6
+1 -11
View File
@@ -5,7 +5,6 @@ import logging
import os
import pty
import select
import signal
import struct
import fcntl
import time
@@ -84,7 +83,7 @@ class TerminalSession:
self.last_activity = time.time()
def _set_terminal_size(self, cols: int, rows: int) -> None:
"""Set the terminal size using TIOCSWINSZ and signal docker exec."""
"""Set the terminal size using TIOCSWINSZ."""
if self._master_fd is None:
logger.warning("Cannot resize: master_fd is None (session not started)")
return
@@ -94,15 +93,6 @@ class TerminalSession:
try:
fcntl.ioctl(self._master_fd, TIOCSWINSZ, size)
logger.info(f"Resized PTY to {cols}x{rows} (fd={self._master_fd})")
# Send SIGWINCH to docker exec process so it re-reads terminal
# size and propagates it to the container's PTY
if self.process and self.process.pid:
try:
os.kill(self.process.pid, signal.SIGWINCH)
logger.info(f"Sent SIGWINCH to docker exec pid={self.process.pid}")
except (OSError, ProcessLookupError) as e:
logger.warning(f"Failed to send SIGWINCH: {e}")
except (OSError, IOError) as e:
logger.error(f"Failed to resize PTY: {e}")