1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-05 15:11:30 -08:00

* 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".
This commit is contained in:
Michael Albinus 2007-01-09 05:04:15 +00:00
parent 5105e99790
commit e64666972e
2 changed files with 33 additions and 22 deletions

View file

@ -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.

View file

@ -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 @@ The terminal type can be configured with `tramp-terminal-type'."
(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)))
(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."
(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 @@ Maybe the different regular expressions need to be tuned.
(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 @@ arguments, and xx will be used as the host name to connect to.
(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 @@ prompt than you do, so it is not at all unlikely that the variable
(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