Function: tramp-get-remote-touch

tramp-get-remote-touch is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-get-remote-touch VEC)

Documentation

Determine remote touch command.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-get-remote-touch (vec)
  "Determine remote `touch' command."
  (with-tramp-connection-property vec "touch"
    (tramp-message vec 5 "Finding a suitable `touch' command")
    (when-let* ((result (tramp-find-executable
			 vec "touch" (tramp-get-remote-path vec)))
		(tmpfile (tramp-make-tramp-temp-name vec)))
      (prog1 result
	;; Busyboxes do support the "-t" option only when they have
	;; been built with the DESKTOP config option.  Let's check it.
	(tramp-set-connection-property
	 vec "touch-t"
	 (tramp-send-command-and-check
	  vec
	  (format
	   "%s -t %s %s"
	   result
	   (format-time-string "%Y%m%d%H%M.%S")
	   (tramp-file-local-name tmpfile))))
	;; The touch command included in busybox (version 1.30.1-6) on
	;; OpenWrt does not have the option "-h".
	(tramp-set-connection-property
	 vec "touch-h"
	 (tramp-send-command-and-check
	  vec (format "%s -h %s" result (tramp-file-local-name tmpfile))))
	(delete-file tmpfile)))))