Function: tramp-smb-wait-for-output

tramp-smb-wait-for-output is a byte-compiled function defined in tramp-smb.el.gz.

Signature

(tramp-smb-wait-for-output VEC)

Documentation

Wait for output from smbclient command.

Removes smb prompt. Returns nil if an error message has appeared.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-smb.el.gz
;; We don't use timeouts.  If needed, the caller shall wrap around.
(defun tramp-smb-wait-for-output (vec)
  "Wait for output from smbclient command.
Removes smb prompt.  Returns nil if an error message has appeared."
  (with-current-buffer (tramp-get-connection-buffer vec)
    (let ((p (get-buffer-process (current-buffer)))
	  (inhibit-read-only t))

      ;; Read pending output.
      (tramp-accept-process-output p)
      (while (and (process-live-p p)
		  (not (search-forward-regexp tramp-smb-prompt nil t)))
	(while (tramp-accept-process-output p))
	(goto-char (point-min)))
      (tramp-message vec 6 "%S\n%s" p (buffer-string))

      ;; Remove prompt.
      (goto-char (point-min))
      (when (search-forward-regexp tramp-smb-prompt nil t)
	(goto-char (point-max))
	(search-backward-regexp tramp-smb-prompt nil t)
	(delete-region (point) (point-max)))

      ;; Return value is whether no error message has appeared.
      (goto-char (point-min))
      (not (search-forward-regexp tramp-smb-errors nil t)))))