Function: tramp-adb-wait-for-output
tramp-adb-wait-for-output is a byte-compiled function defined in
tramp-adb.el.gz.
Signature
(tramp-adb-wait-for-output PROC &optional TIMEOUT)
Documentation
Wait for output from remote command.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-adb.el.gz
(defun tramp-adb-wait-for-output (proc &optional timeout)
"Wait for output from remote command."
(unless (buffer-live-p (process-buffer proc))
(delete-process proc)
(tramp-error proc 'file-error "Process `%s' not available, try again" proc))
(let ((prompt (tramp-get-connection-property proc "prompt" tramp-adb-prompt)))
(with-current-buffer (process-buffer proc)
(if (tramp-wait-for-regexp proc timeout prompt)
(let ((inhibit-read-only t))
(goto-char (point-min))
;; ADB terminal sends "^H" sequences.
(when (search-forward-regexp (rx "<" (+ "\b")) (line-end-position) t)
(forward-line 1)
(delete-region (point-min) (point)))
;; Delete the prompt.
(goto-char (point-min))
(when (search-forward-regexp prompt (line-end-position) t)
(forward-line 1)
(delete-region (point-min) (point)))
(when (tramp-search-regexp prompt)
(delete-region (point) (point-max))))
(if timeout
(tramp-error
proc 'file-error
"[[Remote prompt `%s' not found in %d secs]]" prompt timeout)
(tramp-error
proc 'file-error "[[Remote prompt `%s' not found]]" prompt))))))