Skip to content

Commit

Permalink
Send SSH window change message on SIGWINCH when pty=True
Browse files Browse the repository at this point in the history
Co-Authored-By: Pierce Lopez <[email protected]>
  • Loading branch information
bitprophet and ploxiln committed Aug 22, 2021
1 parent 8125407 commit 835959b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fabric/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import re
import six
import subprocess
import signal
import sys
import time
from glob import glob
Expand Down Expand Up @@ -767,6 +768,13 @@ def _execute(channel, command, pty=True, combine_stderr=None,
rows, cols = _pty_size()
channel.get_pty(width=cols, height=rows)

def handle_window_change(signum, frame):
rows, cols = _pty_size()
channel.resize_pty(width=cols, height=rows)

if hasattr(signal, "SIGWINCH"):
signal.signal(signal.SIGWINCH, handle_window_change)

# Use SSH agent forwarding from 'ssh' if enabled by user
config_agent = ssh_config().get('forwardagent', 'no').lower() == 'yes'
forward = None
Expand Down

0 comments on commit 835959b

Please sign in to comment.