From e64666972e4d08ee3f83af024f3531c62ebebe0a Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 9 Jan 2007 05:04:15 +0000 Subject: [PATCH] * 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". --- lisp/ChangeLog | 7 +++++++ lisp/net/tramp.el | 48 +++++++++++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b7cce56092e..db118187f1d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2007-01-09 Michael Albinus + + * 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 * progmodes/compile.el (compile): Doc fix. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 822a995230e..4d3ee29c4d6 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -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 ;; Michael Albinus @@ -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 -- 2.39.2