unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30595: [PATCH] Handle command line wrapping in Tramp adb.
@ 2018-02-24 18:07 Mathieu Othacehe
  2018-02-26 15:59 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Othacehe @ 2018-02-24 18:07 UTC (permalink / raw)
  To: 30595; +Cc: Mathieu Othacehe

The command sent to an adb shell input might be wrapped around
terminal column count by the kernel. Remove CR and LF introduced when
it happends.

* lisp/net/tramp-adb.el (tramp-adb-send-command): Remove W32 trailing
  CR but also CR/LF introduced by command line wrapping.
---
 lisp/net/tramp-adb.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index be269aca51..532569414b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1178,14 +1178,17 @@ tramp-adb-send-command
   (with-current-buffer (tramp-get-connection-buffer vec)
     (save-excursion
       (goto-char (point-min))
-      ;; We can't use stty to disable echo of command.
-      (delete-matching-lines (regexp-quote command))
       ;; When the local machine is W32, there are still trailing ^M.
       ;; There must be a better solution by setting the correct coding
       ;; system, but this requires changes in core Tramp.
+      ;;
+      ;; Also remove CR and LF introduced by kernel when input command
+      ;; is longer than terminal column count.
+      (while (re-search-forward "\r+\n*" nil t)
+	(replace-match "" nil nil))
       (goto-char (point-min))
-      (while (re-search-forward "\r+$" nil t)
-	(replace-match "" nil nil)))))
+      ;; We can't use stty to disable echo of command.
+      (delete-matching-lines (regexp-quote command)))))
 
 (defun tramp-adb-send-command-and-check (vec command)
   "Run COMMAND and check its exit status.
-- 
2.16.1






^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-05 11:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-24 18:07 bug#30595: [PATCH] Handle command line wrapping in Tramp adb Mathieu Othacehe
2018-02-26 15:59 ` Michael Albinus
2018-02-27 17:13   ` Mathieu Othacehe
2018-05-14 11:09     ` Michael Albinus
2018-06-05 11:09       ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).