(autoload 'zeroconf-init "zeroconf")
(tramp-compat-funcall 'dbus-get-unique-name :system)
(tramp-compat-funcall 'dbus-get-unique-name :session)
- (or (tramp-process-running-p "gvfs-fuse-daemon")
+ (or ;; Until Emacs 25, `process-attributes' could crash Emacs
+ ;; for some processes. Better we don't check.
+ (<= emacs-major-version 25)
+ (tramp-process-running-p "gvfs-fuse-daemon")
(tramp-process-running-p "gvfsd-fuse"))))
"Non-nil when GVFS is available.")
(defun tramp-handle-start-file-process (name buffer program &rest args)
"Like `start-file-process' for Tramp files.
BUFFER might be a list, in this case STDERR is separated."
- ;; `make-process' knows the `:file-handler' argument since Emacs 27.1 only.
+ ;; `make-process' knows the `:file-handler' argument since Emacs
+ ;; 27.1 only. Therefore, we invoke it via `tramp-file-name-handler'.
(tramp-file-name-handler
'make-process
:name name
"Return t if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
(catch 'result
- (dolist (pid (tramp-compat-funcall 'list-system-processes))
- (let ((attributes (process-attributes pid)))
+ (dolist (pid (list-system-processes))
+ (when-let ((attributes (process-attributes pid))
+ (comm (cdr (assoc 'comm attributes))))
(and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
- (when-let ((comm (cdr (assoc 'comm attributes))))
- ;; The returned command name could be truncated to 15
- ;; characters. Therefore, we cannot check for `string-equal'.
- (string-prefix-p comm process-name))
+ ;; The returned command name could be truncated to 15
+ ;; characters. Therefore, we cannot check for `string-equal'.
+ (string-prefix-p comm process-name)
(throw 'result t)))))))
(defun tramp-read-passwd (proc &optional prompt)
(should (zerop (process-file "true")))
(should-not (zerop (process-file "false")))
(should-not (zerop (process-file "binary-does-not-exist")))
- (should (= (if (getenv "EMACS_HYDRA_CI") 127 42)
- (process-file "sh" nil nil nil "-c" "exit 42")))
+ (should
+ (= 42
+ (process-file
+ (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
+ nil nil nil "-c" "exit 42")))
;; Return string in case the process is interrupted.
- (should (stringp (process-file "sh" nil nil nil "-c" "kill -2 $$")))
+ (should
+ (string-equal
+ "Signal 2"
+ (process-file
+ (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
+ nil nil nil "-c" "kill -2 $$")))
+
(with-temp-buffer
(write-region "foo" nil tmp-name)
(should (file-exists-p tmp-name))
kill-buffer-query-functions)
;; Check INSIDE_EMACS.
+ (setenv "INSIDE_EMACS")
(should
(string-equal
(format "%s,tramp:%s" emacs-version tramp-version)