;;; 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\e,A_\e(Bjohann <kai.grossjohann@gmx.net>
;; Michael Albinus <michael.albinus@gmx.de>
(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)
(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)))))
(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)
(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