tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tramp mosh method


From: Michael Albinus
Subject: Re: Tramp mosh method
Date: Wed, 19 Dec 2012 15:34:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Ted Zlatanov <address@hidden> writes:

Hi Ted,

> I started on the code but can't figure out how to fool mosh-server into
> thinking it has a TTY.  It still exits if the terminal height is 0.

"stty" is your friend.

> I added a tramp-process-environment parameter which sets *additional*
> environment parameters in the Tramp session.  I don't think the existing
> tramp*env parameters do what I need.

Not needed. And also some other mosh related settings in tramp-sh.el you
have tried.

> I am attaching my work in progress, which hard-codes a mosh session to
> one of my hosts (wd01).  I tried /usr/bin/script and other tricks but
> just can't get mosh-server to believe the terminal is valid.  I would
> really like to avoid having to make a source patch against mosh to make
> it usable over Tramp, so any ideas are welcome.

Here is a patch (towards Tramp Git) which allows me to connect via mosh
remotely, using my local machine as remote via "C-x C-f /mosh::". I have
commented the setting of the process filter, in order to see the mosh
call output in the debug buffer (tramp-verbose 10 is needed). I also
needed to set "LC_ALL" to "C.UTF-8"; mosh requires that.

--8<---------------cut here---------------start------------->8---
~/src/tramp/lisp> git diff tramp-sh.el
diff --git a/lisp/tramp-sh.el b/lisp/tramp-sh.el
index 97270f0..e410aac 100644
--- a/lisp/tramp-sh.el
+++ b/lisp/tramp-sh.el
@@ -406,6 +406,20 @@ detected as prompt when being sent on echoing hosts, 
therefore.")
     (tramp-copy-program         "fcp")
     (tramp-copy-args            (("-p" "%k")))
     (tramp-copy-keep-date       t)))
+;;;###tramp-autoload
+(add-to-list 'tramp-methods
+  `("mosh"
+    (tramp-login-program        "mosh")
+    (tramp-login-args           (("-p" "%p") ("%h")))
+    (tramp-remote-shell         "/bin/sh")
+    (tramp-remote-shell-args    ("-c"))
+    (tramp-copy-keep-date       t)
+    (tramp-copy-recursive       t)
+    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
+                                 ("-o" "UserKnownHostsFile=/dev/null")
+                                 ("-o" "StrictHostKeyChecking=no")))
+;    (tramp-process-filter       'tramp-mosh-process-filter)
+    (tramp-default-port         22)))
 
 ;;;###tramp-autoload
 (add-to-list 'tramp-default-method-alist
@@ -4392,7 +4406,7 @@ connection if a previous connection has died for some 
reason."
              (when (and p (processp p))
                (delete-process p))
              (setenv "TERM" tramp-terminal-type)
-             (setenv "LC_ALL" "C")
+             (setenv "LC_ALL" "C.UTF-8")
              (setenv "PROMPT_COMMAND")
              (setenv "PS1" tramp-initial-end-of-output)
              (let* ((target-alist (tramp-compute-multi-hops vec))
@@ -4428,6 +4442,11 @@ connection if a previous connection has died for some 
reason."
                 p 60
                 "Couldn't find local shell prompt %s" tramp-encoding-shell)
 
+               ;; Set rows and columns for mosh.  Hard coded; better
+               ;; to indicate by a flag in `tramp-methods'.
+               (tramp-send-command vec "stty rows 80" t t)
+               (tramp-send-command vec "stty cols 80" t t)
+
                ;; Now do all the connections as specified.
                (while target-alist
                  (let* ((hop (car target-alist))
--8<---------------cut here---------------end--------------->8---

Have fun!

> Ted

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]