Function: tramp-adb-send-command-and-check
tramp-adb-send-command-and-check is a byte-compiled function defined
in tramp-adb.el.gz.
Signature
(tramp-adb-send-command-and-check VEC COMMAND &optional EXIT-STATUS)
Documentation
Run COMMAND and check its exit status.
Sends echo $? along with the COMMAND for checking the exit
status. If COMMAND is nil, just sends echo $?. Returns nil if
the exit status is not equal 0, and t otherwise.
Optional argument EXIT-STATUS, if non-nil, triggers the return of the exit status.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-adb.el.gz
(defun tramp-adb-send-command-and-check (vec command &optional exit-status)
"Run COMMAND and check its exit status.
Sends `echo $?' along with the COMMAND for checking the exit
status. If COMMAND is nil, just sends `echo $?'. Returns nil if
the exit status is not equal 0, and t otherwise.
Optional argument EXIT-STATUS, if non-nil, triggers the return of
the exit status."
(tramp-adb-send-command
vec (if command
(format "%s; echo tramp_exit_status $?" command)
"echo tramp_exit_status $?"))
(with-current-buffer (tramp-get-connection-buffer vec)
(unless (tramp-search-regexp "tramp_exit_status [[:digit:]]+")
(tramp-error
vec 'file-error "Couldn't find exit status of `%s'" command))
(skip-chars-forward "^ ")
(prog1
(if exit-status
(read (current-buffer))
(zerop (read (current-buffer))))
(let ((inhibit-read-only t))
(delete-region (match-beginning 0) (point-max))))))