Function: tramp-process-one-action

tramp-process-one-action is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-process-one-action PROC VEC ACTIONS)

Documentation

Wait for output from the shell and perform one action.

See tramp-process-actions for the format of ACTIONS.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;;; Functions for processing the actions:

(defun tramp-process-one-action (proc vec actions)
  "Wait for output from the shell and perform one action.
See `tramp-process-actions' for the format of ACTIONS."
  (let ((case-fold-search t)
	tramp-process-action-regexp
	found todo item pattern action)
    (while (not found)
      ;; Reread output once all actions have been performed.
      ;; Obviously, the output was not complete.
      (while (tramp-accept-process-output proc))
      ;; Remove ANSI control escape sequences.
      (with-current-buffer (tramp-get-connection-buffer vec)
	(goto-char (point-min))
	(while (search-forward-regexp ansi-color-control-seq-regexp nil t)
	  (replace-match "")))
      (setq todo actions)
      (while todo
	(setq item (pop todo)
	      tramp-process-action-regexp (symbol-value (nth 0 item))
	      pattern (rx (group (regexp tramp-process-action-regexp)) eos)
	      action (nth 1 item))
	(tramp-message
	 vec 5 "Looking for regexp \"%s\" from remote shell" pattern)
	(when (tramp-check-for-regexp proc pattern)
	  (tramp-message vec 5 "Call `%s'" (symbol-name action))
	  (setq found (funcall action proc vec)))))
    found))