]> code.delx.au - gnu-emacs/commitdiff
* net/tramp-sh.el (tramp-send-command): Fix the case where the
authorWolfgang Jenkner <wjenkner@inode.at>
Sat, 1 Nov 2014 14:08:00 +0000 (15:08 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 1 Nov 2014 14:08:00 +0000 (15:08 +0100)
remote-echo connection property is non-nil.

Fixes: debbugs:18858
lisp/ChangeLog
lisp/net/tramp-sh.el

index 2577f7fe02f3ef4ef8ad047c198cfe562d6cf9fc..731a71a9f492ff69864e084637fffa2a9932696f 100644 (file)
@@ -1,3 +1,8 @@
+2014-11-01  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * net/tramp-sh.el (tramp-send-command): Fix the case where the
+       remote-echo connection property is non-nil (bug#18858).
+
 2014-11-01  Michael Albinus  <michael.albinus@gmx.de>
 
        Backport Tramp changes from trunk.
index 1976e0e7f668cf8d770580faa9a3f9c33f7a36d0..186a51c5bb87865b0a5fabb4369bea2e4bfb1ee0 100644 (file)
@@ -4769,6 +4769,17 @@ function waits for output unless NOOUTPUT is set."
     (when (tramp-get-connection-property p "remote-echo" nil)
       ;; We mark the command string that it can be erased in the output buffer.
       (tramp-set-connection-property p "check-remote-echo" t)
+      ;; If we put `tramp-echo-mark' after a trailing newline (which
+      ;; is assumed to be unquoted) `tramp-send-string' doesn't see
+      ;; that newline and adds `tramp-rsh-end-of-line' right after
+      ;; `tramp-echo-mark', so the remote shell sees two consecutive
+      ;; trailing line endings and sends two prompts after executing
+      ;; the command, which confuses `tramp-wait-for-output'.
+      (when (and (not (string= command ""))
+                (string-equal (substring command -1) "\n"))
+       (setq command (substring command 0 -1)))
+      ;; No need to restore a trailing newline here since `tramp-send-string'
+      ;; makes sure that the string ends in `tramp-rsh-end-of-line', anyway.
       (setq command (format "%s%s%s" tramp-echo-mark command tramp-echo-mark)))
     ;; Send the command.
     (tramp-message vec 6 "%s" command)