Function: tramp-barf-if-no-shell-prompt

tramp-barf-if-no-shell-prompt is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-barf-if-no-shell-prompt PROC TIMEOUT &rest ERROR-ARGS)

Documentation

Wait for shell prompt and barf if none appears.

Looks at process PROC to see if a shell prompt appears in TIMEOUT seconds. If not, it produces an error message with the given ERROR-ARGS.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
;; Utility functions.

(defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args)
  "Wait for shell prompt and barf if none appears.
Looks at process PROC to see if a shell prompt appears in TIMEOUT
seconds.  If not, it produces an error message with the given ERROR-ARGS."
  (let ((vec (process-get proc 'tramp-vector)))
    (condition-case nil
	(tramp-wait-for-regexp
	 proc timeout
	 (tramp-compat-rx
	  (| (regexp shell-prompt-pattern) (regexp tramp-shell-prompt-pattern))
	  (? (regexp ansi-color-control-seq-regexp))
	  eos))
      (error
       (delete-process proc)
       (apply #'tramp-error-with-buffer
	      (tramp-get-connection-buffer vec) vec 'file-error error-args)))))