From bede3e9f87bd10b0fb0f3f516353667c63082dd4 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 16 Jul 2009 10:24:07 +0000 Subject: [PATCH] * net/tramp.el (tramp-wait-for-output): Handle the case when commands do not return a newline but a null byte before the shell prompt. (Bug#3858) --- lisp/ChangeLog | 6 ++++++ lisp/net/tramp.el | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 785daed8197..a3591f99e49 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-07-16 Michael Albinus + + * net/tramp.el (tramp-wait-for-output): Handle the case when + commands do not return a newline but a null byte before the shell + prompt. (Bug#3858) + 2009-07-16 YAMAMOTO Mitsuharu * term/ns-win.el (ns-set-alpha): Don't declare. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 444f55ac5d2..6de2346b766 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3898,15 +3898,15 @@ beginning of local filename are not substituted." ;; Determine output. (cond - ;; Just a buffer + ;; Just a buffer. ((bufferp destination) (setq outbuf destination)) - ;; A buffer name + ;; A buffer name. ((stringp destination) (setq outbuf (get-buffer-create destination))) ;; (REAL-DESTINATION ERROR-DESTINATION) ((consp destination) - ;; output + ;; output. (cond ((bufferp (car destination)) (setq outbuf (car destination))) @@ -3914,7 +3914,7 @@ beginning of local filename are not substituted." (setq outbuf (get-buffer-create (car destination)))) ((car destination) (setq outbuf (current-buffer)))) - ;; stderr + ;; stderr. (cond ((stringp (cadr destination)) (setcar (cdr destination) (expand-file-name (cadr destination))) @@ -3927,7 +3927,7 @@ beginning of local filename are not substituted." (setq stderr (tramp-make-tramp-temp-file v) tmpstderr (tramp-make-tramp-file-name method user host stderr)))) - ;; stderr to be discarded + ;; stderr to be discarded. ((null (cadr destination)) (setq stderr "/dev/null")))) ;; 't @@ -6660,10 +6660,14 @@ function waits for output unless NOOUTPUT is set." (defun tramp-wait-for-output (proc &optional timeout) "Wait for output from remote rsh command." (with-current-buffer (process-buffer proc) - ;; Initially, `tramp-end-of-output' is "$ ". There might be - ;; leading escape sequences, which must be ignored. - (let* ((regexp (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) - (found (tramp-wait-for-regexp proc timeout regexp))) + (let* (;; Initially, `tramp-end-of-output' is "$ ". There might + ;; be leading escape sequences, which must be ignored. + (regexp (format "[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) + ;; Sometimes, the commands do not return a newline but a + ;; null byte before the shell prompt, for example "git + ;; ls-files -c -z ...". + (regexp1 (format "\\(^\\|\000\\)%s" regexp)) + (found (tramp-wait-for-regexp proc timeout regexp1))) (if found (let (buffer-read-only) (goto-char (point-max)) -- 2.39.2