Function: tramp-adb-handle-process-file

tramp-adb-handle-process-file is a byte-compiled function defined in tramp-adb.el.gz.

Signature

(tramp-adb-handle-process-file PROGRAM &optional INFILE DESTINATION DISPLAY &rest ARGS)

Documentation

Like process-file for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-adb.el.gz
(defun tramp-adb-handle-process-file
  (program &optional infile destination display &rest args)
  "Like `process-file' for Tramp files."
  (tramp-skeleton-process-file program infile destination display args
      ;; Compute command.
      (setq command (mapconcat #'tramp-shell-quote-argument
			       (cons program args) " "))
      (when input (setq command (format "%s <%s" command input)))
      (when stderr (setq command (format "%s 2>%s" command stderr)))

      ;; Send the command.  It might not return in time, so we protect
      ;; it.  Call it in a subshell, in order to preserve working
      ;; directory.
      (condition-case nil
	  (unwind-protect
	      (setq ret (tramp-adb-send-command-and-check
			 v (format
			    "(cd %s; %s)"
			    (tramp-unquote-shell-quote-argument localname)
			    command)
			 t))
	    (unless (natnump ret) (setq ret 1))
	    ;; We should add the output anyway.
	    (when outbuf
	      (with-current-buffer outbuf
		(insert-buffer-substring (tramp-get-connection-buffer v)))
	      (when (and display (get-buffer-window outbuf t)) (redisplay))))

	;; When the user did interrupt, we should do it also.  We use
	;; return code -1 as marker.
	(quit
	 (kill-buffer (tramp-get-connection-buffer v))
	 (setq ret -1))
	;; Handle errors.
	(error
	 (kill-buffer (tramp-get-connection-buffer v))
	 (setq ret 1)))

      (when (and process-file-return-signal-string
		 (natnump ret) (> ret 128))
	(setq ret (nth (- ret 128) (tramp-adb-get-signal-strings v))))))