[mosh-devel] $TERM Environment Variable

Alexander Chernyakhovsky achernya at MIT.EDU
Mon Jun 18 11:34:12 EDT 2012


Hi John,

Overriding the TERM variable for mosh is very detrimental, as mosh implements only xterm and xterm-256color terminfo.

It seems a better solution for your problem is to check for the existence $SSH_* variables (SSH_CONNECTION, etc) and set up your tmux to not ssh further if they are present. This will work even with mosh, as mosh leaves the SSH variables set from the initial connection used to bootstrap the mosh connection.

Sincerely,
-Alex
mosh packager for Fedora
________________________________
From: mosh-devel-bounces at MIT.EDU [mosh-devel-bounces at MIT.EDU] on behalf of John Terenzio [john at terenz.io]
Sent: Monday, June 18, 2012 10:47 AM
To: mosh-devel at mit.edu
Subject: [mosh-devel] $TERM Environment Variable

Hi,

I've been enjoying using Mosh but I have a small issue with the $TERM variable. My use case is that I run Tmux locally, then inside that session I connect to another server with Mosh. Before, when I used SSH, my $TERM variable from inside Tmux ("screen-256color") would get forwarded to the remote host. I have my computers set up so that Tmux starts automatically if the $TERM variable does not start with "screen". With SSH, nothing would happen on the remote host, but with Mosh I'll get nested Tmux sessions because the remote host doesn't know it's already inside Tmux (it sees "xterm-256color").

I patched my copy of Mosh by removing the lines that set the $TERM variable, which make it just inherit the current one (diff attached). This works for me and I don't see a downside to it, but I also thought about adding a command line switch to override the $TERM variable if what I did isn't robust enough. If you tell me your thoughts on fixing it I'm happy to submit a pull request.

Thanks!
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/mosh-devel/attachments/20120618/57baa434/attachment.html


More information about the mosh-devel mailing list