Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote: pty-mode passes through TERM env-var #2236

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion fabric/runners.py
@@ -1,3 +1,4 @@
import os
import signal

from invoke import Runner, pty_size, Result as InvokeResult
Expand Down Expand Up @@ -39,7 +40,12 @@ def start(self, command, shell, env, timeout=None):
if self.using_pty:
# Set initial size to match local size
cols, rows = pty_size()
self.channel.get_pty(width=cols, height=rows)
get_pty_kwargs = {}
if "TERM" in env:
get_pty_kwargs.update(term=env["TERM"])
elif "TERM" in os.environ:
get_pty_kwargs.update(term=os.environ["TERM"])
self.channel.get_pty(width=cols, height=rows, **get_pty_kwargs)
# If platform supports, also respond to SIGWINCH (window change) by
# sending the sshd a window-change message to update
if hasattr(signal, "SIGWINCH"):
Expand Down