Mercurial > emacs
changeset 75148:bdffb0038313
* net/tramp.el: (tramp-process-one-action): Remove `with-timeout'.
(tramp-process-actions): Add optional parameter TIMEOUT.
(tramp-open-connection-telnet, tramp-open-connection-rsh)
(tramp-open-connection-su): Add timeout of 60".
author | Michael Albinus <michael.albinus@gmx.de> |
---|---|
date | Tue, 09 Jan 2007 05:04:15 +0000 |
parents | d54d52e3741e |
children | 0fd7f29f20d1 |
files | lisp/ChangeLog lisp/net/tramp.el |
diffstat | 2 files changed, 34 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Jan 09 03:14:05 2007 +0000 +++ b/lisp/ChangeLog Tue Jan 09 05:04:15 2007 +0000 @@ -1,3 +1,10 @@ +2007-01-09 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el: (tramp-process-one-action): Remove `with-timeout'. + (tramp-process-actions): Add optional parameter TIMEOUT. + (tramp-open-connection-telnet, tramp-open-connection-rsh) + (tramp-open-connection-su): Add timeout of 60". + 2007-01-09 Richard Stallman <rms@gnu.org> * progmodes/compile.el (compile): Doc fix.
--- a/lisp/net/tramp.el Tue Jan 09 03:14:05 2007 +0000 +++ b/lisp/net/tramp.el Tue Jan 09 05:04:15 2007 +0000 @@ -2,7 +2,7 @@ ;;; tramp.el --- Transparent Remote Access, Multiple Protocol ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006 Free Software Foundation, Inc. +;; 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net> ;; Michael Albinus <michael.albinus@gmx.de> @@ -5540,32 +5540,36 @@ (let (found item pattern action todo) (erase-buffer) (tramp-message 9 "Waiting 60s for prompt from remote shell") - (with-timeout (60 (throw 'tramp-action 'timeout)) - (while (not found) - (tramp-accept-process-output p 1) + (while (not found) + (tramp-accept-process-output p 1) + (goto-char (point-min)) + (setq todo actions) + (while todo (goto-char (point-min)) - (setq todo actions) - (while todo - (goto-char (point-min)) - (setq item (pop todo)) - (setq pattern (symbol-value (nth 0 item))) - (setq action (nth 1 item)) - (tramp-message 10 "Looking for regexp \"%s\" from remote shell" - pattern) - (when (re-search-forward (concat pattern "\\'") nil t) - (setq found (funcall action p multi-method method user host))))) - found))) - -(defun tramp-process-actions (p multi-method method user host actions) - "Perform actions until success." + (setq item (pop todo)) + (setq pattern (symbol-value (nth 0 item))) + (setq action (nth 1 item)) + (tramp-message 10 "Looking for regexp \"%s\" from remote shell" + pattern) + (when (re-search-forward (concat pattern "\\'") nil t) + (setq found (funcall action p multi-method method user host))))) + found)) + +(defun tramp-process-actions + (p multi-method method user host actions &optional timeout) + "Perform actions until success or TIMEOUT." (tramp-message 10 "%s" (mapconcat 'identity (process-command p) " ")) (let (exit) (while (not exit) (tramp-message 9 "Waiting for prompts from remote shell") (setq exit (catch 'tramp-action - (tramp-process-one-action - p multi-method method user host actions) + (if timeout + (with-timeout (timeout) + (tramp-process-one-action + p multi-method method user host actions)) + (tramp-process-one-action + p multi-method method user host actions)) nil))) (unless (eq exit 'ok) (tramp-clear-passwd user host) @@ -5689,7 +5693,7 @@ (set-buffer (tramp-get-buffer multi-method method user host)) (erase-buffer) (tramp-process-actions p multi-method method user host - tramp-actions-before-shell) + tramp-actions-before-shell 60) (tramp-open-connection-setup-interactive-shell p multi-method method user host) (tramp-post-connection multi-method method user host))))) @@ -5762,7 +5766,7 @@ (set-buffer buf) (tramp-process-actions p multi-method method user host - tramp-actions-before-shell) + tramp-actions-before-shell 60) (tramp-message 7 "Initializing remote shell") (tramp-open-connection-setup-interactive-shell p multi-method method user host) @@ -5823,7 +5827,7 @@ (tramp-set-process-query-on-exit-flag p nil) (set-buffer (tramp-get-buffer multi-method method user host)) (tramp-process-actions p multi-method method user host - tramp-actions-before-shell) + tramp-actions-before-shell 60) (tramp-open-connection-setup-interactive-shell p multi-method method user host) (tramp-post-connection multi-method method