diff options
| author | Stefan Monnier | 2010-12-13 10:27:36 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-12-13 10:27:36 -0500 |
| commit | f49d1f52b2e368ef67dcfececd426de958548f4e (patch) | |
| tree | ce24ced92f2acc976daf4b69e3634c8bd600e44e /lisp/net | |
| parent | 07176b2a9e63a0d3933b167f987475d8a18da5cc (diff) | |
| parent | 11aad4e9f9f54ce8e9ecc66347e512b20a3cdf39 (diff) | |
| download | emacs-f49d1f52b2e368ef67dcfececd426de958548f4e.tar.gz emacs-f49d1f52b2e368ef67dcfececd426de958548f4e.zip | |
Merge from emacs-23
Diffstat (limited to 'lisp/net')
| -rw-r--r-- | lisp/net/tramp-sh.el | 114 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 41 |
2 files changed, 80 insertions, 75 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 1501868a6b5..92f6c2a0335 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -2637,61 +2637,65 @@ the result will be a local, non-Tramp, filename." | |||
| 2637 | (defun tramp-sh-handle-start-file-process (name buffer program &rest args) | 2637 | (defun tramp-sh-handle-start-file-process (name buffer program &rest args) |
| 2638 | "Like `start-file-process' for Tramp files." | 2638 | "Like `start-file-process' for Tramp files." |
| 2639 | (with-parsed-tramp-file-name default-directory nil | 2639 | (with-parsed-tramp-file-name default-directory nil |
| 2640 | (unwind-protect | 2640 | ;; When PROGRAM is nil, we just provide a tty. |
| 2641 | ;; When PROGRAM is nil, we just provide a tty. | 2641 | (let ((command |
| 2642 | (let ((command | 2642 | (when (stringp program) |
| 2643 | (when (stringp program) | 2643 | (format "cd %s; exec %s" |
| 2644 | (format "cd %s; exec %s" | 2644 | (tramp-shell-quote-argument localname) |
| 2645 | (tramp-shell-quote-argument localname) | 2645 | (mapconcat 'tramp-shell-quote-argument |
| 2646 | (mapconcat 'tramp-shell-quote-argument | 2646 | (cons program args) " ")))) |
| 2647 | (cons program args) " ")))) | 2647 | (tramp-process-connection-type |
| 2648 | (tramp-process-connection-type | 2648 | (or (null program) tramp-process-connection-type)) |
| 2649 | (or (null program) tramp-process-connection-type)) | 2649 | (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) |
| 2650 | (name1 name) | 2650 | (name1 name) |
| 2651 | (i 0)) | 2651 | (i 0)) |
| 2652 | (unless buffer | 2652 | (unwind-protect |
| 2653 | ;; BUFFER can be nil. We use a temporary buffer. | 2653 | (save-excursion |
| 2654 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) | 2654 | (save-restriction |
| 2655 | (while (get-process name1) | 2655 | (unless buffer |
| 2656 | ;; NAME must be unique as process name. | 2656 | ;; BUFFER can be nil. We use a temporary buffer. |
| 2657 | (setq i (1+ i) | 2657 | (setq buffer (generate-new-buffer tramp-temp-buffer-name))) |
| 2658 | name1 (format "%s<%d>" name i))) | 2658 | (while (get-process name1) |
| 2659 | (setq name name1) | 2659 | ;; NAME must be unique as process name. |
| 2660 | ;; Set the new process properties. | 2660 | (setq i (1+ i) |
| 2661 | (tramp-set-connection-property v "process-name" name) | 2661 | name1 (format "%s<%d>" name i))) |
| 2662 | (tramp-set-connection-property v "process-buffer" buffer) | 2662 | (setq name name1) |
| 2663 | ;; Activate narrowing in order to save BUFFER contents. | 2663 | ;; Set the new process properties. |
| 2664 | ;; Clear also the modification time; otherwise we might be | 2664 | (tramp-set-connection-property v "process-name" name) |
| 2665 | ;; interrupted by `verify-visited-file-modtime'. | 2665 | (tramp-set-connection-property v "process-buffer" buffer) |
| 2666 | (with-current-buffer (tramp-get-connection-buffer v) | 2666 | ;; Activate narrowing in order to save BUFFER contents. |
| 2667 | (clear-visited-file-modtime) | 2667 | ;; Clear also the modification time; otherwise we might |
| 2668 | (narrow-to-region (point-max) (point-max))) | 2668 | ;; be interrupted by `verify-visited-file-modtime'. |
| 2669 | (if command | 2669 | (with-current-buffer (tramp-get-connection-buffer v) |
| 2670 | ;; Send the command. | 2670 | (let ((buffer-undo-list t)) |
| 2671 | (tramp-send-command v command nil t) ; nooutput | 2671 | (clear-visited-file-modtime) |
| 2672 | ;; Check, whether a pty is associated. | 2672 | (narrow-to-region (point-max) (point-max)) |
| 2673 | (tramp-maybe-open-connection v) | 2673 | (if command |
| 2674 | (unless (tramp-compat-process-get | 2674 | ;; Send the command. |
| 2675 | (tramp-get-connection-process v) 'remote-tty) | 2675 | (tramp-send-command v command nil t) ; nooutput |
| 2676 | (tramp-error | 2676 | ;; Check, whether a pty is associated. |
| 2677 | v 'file-error "pty association is not supported for `%s'" name))) | 2677 | (tramp-maybe-open-connection v) |
| 2678 | (let ((p (tramp-get-connection-process v))) | 2678 | (unless (tramp-compat-process-get |
| 2679 | ;; Set sentinel and query flag for this process. | 2679 | (tramp-get-connection-process v) 'remote-tty) |
| 2680 | (tramp-set-connection-property p "vector" v) | 2680 | (tramp-error |
| 2681 | (set-process-sentinel p 'tramp-process-sentinel) | 2681 | v 'file-error |
| 2682 | (tramp-compat-set-process-query-on-exit-flag p t) | 2682 | "pty association is not supported for `%s'" name))))) |
| 2683 | ;; Return process. | 2683 | (let ((p (tramp-get-connection-process v))) |
| 2684 | p)) | 2684 | ;; Set sentinel and query flag for this process. |
| 2685 | ;; Save exit. | 2685 | (tramp-set-connection-property p "vector" v) |
| 2686 | (with-current-buffer (tramp-get-connection-buffer v) | 2686 | (set-process-sentinel p 'tramp-process-sentinel) |
| 2687 | (if (string-match tramp-temp-buffer-name (buffer-name)) | 2687 | (tramp-compat-set-process-query-on-exit-flag p t) |
| 2688 | (progn | 2688 | ;; Return process. |
| 2689 | (set-process-buffer (tramp-get-connection-process v) nil) | 2689 | p))) |
| 2690 | (kill-buffer (current-buffer))) | 2690 | ;; Save exit. |
| 2691 | (widen) | 2691 | (with-current-buffer (tramp-get-connection-buffer v) |
| 2692 | (goto-char (point-max)))) | 2692 | (if (string-match tramp-temp-buffer-name (buffer-name)) |
| 2693 | (tramp-set-connection-property v "process-name" nil) | 2693 | (progn |
| 2694 | (tramp-set-connection-property v "process-buffer" nil)))) | 2694 | (set-process-buffer (tramp-get-connection-process v) nil) |
| 2695 | (kill-buffer (current-buffer))) | ||
| 2696 | (set-buffer-modified-p bmp))) | ||
| 2697 | (tramp-set-connection-property v "process-name" nil) | ||
| 2698 | (tramp-set-connection-property v "process-buffer" nil))))) | ||
| 2695 | 2699 | ||
| 2696 | (defun tramp-sh-handle-process-file | 2700 | (defun tramp-sh-handle-process-file |
| 2697 | (program &optional infile destination display &rest args) | 2701 | (program &optional infile destination display &rest args) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index f7d3b81039e..abcb6ae7d77 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3077,26 +3077,27 @@ The terminal type can be configured with `tramp-terminal-type'." | |||
| 3077 | (tramp-compat-with-temp-message "" | 3077 | (tramp-compat-with-temp-message "" |
| 3078 | ;; Enable auth-source and password-cache. | 3078 | ;; Enable auth-source and password-cache. |
| 3079 | (tramp-set-connection-property vec "first-password-request" t) | 3079 | (tramp-set-connection-property vec "first-password-request" t) |
| 3080 | (let (exit) | 3080 | (save-restriction |
| 3081 | (while (not exit) | 3081 | (let (exit) |
| 3082 | (tramp-message proc 3 "Waiting for prompts from remote shell") | 3082 | (while (not exit) |
| 3083 | (setq exit | 3083 | (tramp-message proc 3 "Waiting for prompts from remote shell") |
| 3084 | (catch 'tramp-action | 3084 | (setq exit |
| 3085 | (if timeout | 3085 | (catch 'tramp-action |
| 3086 | (with-timeout (timeout) | 3086 | (if timeout |
| 3087 | (tramp-process-one-action proc vec actions)) | 3087 | (with-timeout (timeout) |
| 3088 | (tramp-process-one-action proc vec actions))))) | 3088 | (tramp-process-one-action proc vec actions)) |
| 3089 | (with-current-buffer (tramp-get-connection-buffer vec) | 3089 | (tramp-process-one-action proc vec actions))))) |
| 3090 | (widen) | 3090 | (with-current-buffer (tramp-get-connection-buffer vec) |
| 3091 | (tramp-message vec 6 "\n%s" (buffer-string))) | 3091 | (widen) |
| 3092 | (unless (eq exit 'ok) | 3092 | (tramp-message vec 6 "\n%s" (buffer-string))) |
| 3093 | (tramp-clear-passwd vec) | 3093 | (unless (eq exit 'ok) |
| 3094 | (tramp-error-with-buffer | 3094 | (tramp-clear-passwd vec) |
| 3095 | nil vec 'file-error | 3095 | (tramp-error-with-buffer |
| 3096 | (cond | 3096 | nil vec 'file-error |
| 3097 | ((eq exit 'permission-denied) "Permission denied") | 3097 | (cond |
| 3098 | ((eq exit 'process-died) "Process died") | 3098 | ((eq exit 'permission-denied) "Permission denied") |
| 3099 | (t "Login failed"))))))) | 3099 | ((eq exit 'process-died) "Process died") |
| 3100 | (t "Login failed")))))))) | ||
| 3100 | 3101 | ||
| 3101 | :;; Utility functions: | 3102 | :;; Utility functions: |
| 3102 | 3103 | ||