Function: tramp-sudoedit-send-command-and-read

tramp-sudoedit-send-command-and-read is a byte-compiled function defined in tramp-sudoedit.el.gz.

Signature

(tramp-sudoedit-send-command-and-read VEC &rest ARGS)

Documentation

Run command ARGS and return the output, which must be a Lisp expression.

In case there is no valid Lisp expression, it raises an error.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-send-command-and-read (vec &rest args)
  "Run command ARGS and return the output, which must be a Lisp expression.
In case there is no valid Lisp expression, it raises an error."
  (when (apply #'tramp-sudoedit-send-command vec args)
    (with-current-buffer (tramp-get-connection-buffer vec)
      ;; Replace stat marker.
      (goto-char (point-min))
      (when (search-forward tramp-stat-marker nil t)
	(goto-char (point-min))
	(while (search-forward "\"" nil t)
	  (replace-match "\\\"" nil 'literal))
	(goto-char (point-min))
	(while (search-forward tramp-stat-marker nil t)
	  (replace-match "\"")))
      ;; Read the expression.
      (tramp-message vec 6 "\n%s" (buffer-string))
      (goto-char (point-min))
      (condition-case nil
	  (prog1 (read (current-buffer))
	    ;; Error handling.
	    (when (search-forward-regexp (rx (not blank)) (line-end-position) t)
	      (error nil)))
	(error (tramp-error
		vec 'remote-file-error
		"`%s' does not return a valid Lisp expression: `%s'"
		(car args) (buffer-string)))))))