Skip to content

Commit

Permalink
Fix error on unset TERM env variable (#296)
Browse files Browse the repository at this point in the history
fixes #295
  • Loading branch information
johnfzc authored and jathanism committed Aug 12, 2016
1 parent 7ab0535 commit ddca877
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions trigger/conf/global_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
# general use within the .tacacsrc
DEFAULT_REALM = 'aol'

# Default terminal type of xterm if TERM isn't set
TERM_TYPE = os.getenv('TERM', 'xterm')

# List of plugins allowed to be importd by Commando. Plugins should be listed as
# strings depicting the absolute paths.
#
Expand Down
4 changes: 2 additions & 2 deletions trigger/twister.py
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ class TriggerSSHPtyChannel(channel.SSHChannel):

def channelOpen(self, data):
"""Setup the terminal when the channel opens."""
pr = session.packRequest_pty_req(os.environ['TERM'],
pr = session.packRequest_pty_req(settings.TERM_TYPE,
self._get_window_size(), '')
self.conn.sendRequest(self, 'pty-req', pr)
self.conn.sendRequest(self, 'shell', '')
Expand Down Expand Up @@ -1414,7 +1414,7 @@ def channelOpen(self, data):

# Request a pty even tho we are not actually using one.
pr = session.packRequest_pty_req(
os.environ['TERM'], (80, 24, 0, 0), ''
settings.TERM_TYPE, (80, 24, 0, 0), ''
)
self.conn.sendRequest(self, 'pty-req', pr)
d = self.conn.sendRequest(self, 'shell', '', wantReply=True)
Expand Down

0 comments on commit ddca877

Please sign in to comment.