Function: tramp-sudoedit-send-command

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

Signature

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

Documentation

Send commands ARGS to connection VEC.

If an element of ARGS is a list, it will be flattened. If an element of ARGS is nil, it will be deleted. Erases temporary buffer before sending the command. Returns nil in case of error, t otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sudoedit.el.gz
(defun tramp-sudoedit-send-command (vec &rest args)
  "Send commands ARGS to connection VEC.
If an element of ARGS is a list, it will be flattened.  If an
element of ARGS is nil, it will be deleted.
Erases temporary buffer before sending the command.  Returns nil
in case of error, t otherwise."
  (tramp-sudoedit-maybe-open-connection vec)
  (with-current-buffer (tramp-get-connection-buffer vec)
    (erase-buffer)
    (let* ((delete-exited-processes t)
	   (process-connection-type tramp-process-connection-type)
	   (p (apply #'start-process
		     (tramp-get-connection-name vec) (current-buffer)
		     (append
		      (tramp-expand-args
		       vec 'tramp-sudo-login
		       ?h (or (tramp-file-name-host vec) "")
		       ?u (or (tramp-file-name-user vec) ""))
		      (tramp-compat-flatten-tree args))))
	   ;; We suppress the messages `Waiting for prompts from remote shell'.
	   (tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
	   ;; The password shall be cached also in case of "emacs -Q".
	   ;; See `tramp-process-actions'.
	   (tramp-cache-read-persistent-data t)
	   ;; We do not want to save the password.
	   auth-source-save-behavior)
      (tramp-message vec 6 "%s" (string-join (process-command p) " "))
      ;; Avoid process status message in output buffer.
      (set-process-sentinel p #'ignore)
      (process-put p 'tramp-vector vec)
      (process-put p 'adjust-window-size-function #'ignore)
      (set-process-query-on-exit-flag p nil)
      (tramp-set-connection-property p "password-vector" tramp-sudoedit-null-hop)
      (tramp-process-actions p vec nil tramp-sudoedit-sudo-actions)
      (tramp-message vec 6 "%s\n%s" (process-exit-status p) (buffer-string))
      (prog1
	  (zerop (process-exit-status p))
	(delete-process p)))))