summaryrefslogtreecommitdiff
path: root/lisp/net/tramp.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-01-31 10:29:02 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-01-31 10:29:02 +0100
commitd3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c (patch)
tree917ed5f0309542cdf49414ed6c7f79520118c245 /lisp/net/tramp.el
parent78b87263920e9ba73b37c5014acf6c88b745764f (diff)
downloademacs-d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c.tar.gz
emacs-d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c.tar.bz2
emacs-d3ead375092e2690c1d1d6a5dd82e6e89cdf4f4c.zip
Remove compatibility hack in Tramp
* lisp/net/tramp-compat.el (tramp-compat-process-running-p): Remove. * lisp/net/tramp-gvfs.el (tramp-gvfs-enabled): Use `tramp-process-running-p'. * lisp/net/lisp/net/tramp.el (with-tramp-progress-reporter): Simplify. (tramp-process-running-p): New defun.
Diffstat (limited to 'lisp/net/tramp.el')
-rw-r--r--lisp/net/tramp.el19
1 files changed, 16 insertions, 3 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 131681a8fdc..70d0fb070d8 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1999,9 +1999,9 @@ without a visible progress reporter."
(tm
;; We start a pulsing progress reporter after 3
;; seconds. Display only when there is a minimum level.
- (when (<= ,level (min tramp-verbose 3))
- (when-let ((pr (make-progress-reporter ,message nil nil)))
- (run-at-time 3 0.1 #'tramp-progress-reporter-update pr)))))
+ (when-let ((pr (and (<= ,level (min tramp-verbose 3))
+ (make-progress-reporter ,message nil nil))))
+ (run-at-time 3 0.1 #'tramp-progress-reporter-update pr))))
(unwind-protect
;; Execute the body.
(prog1 (progn ,@body) (setq cookie "done"))
@@ -4816,6 +4816,19 @@ verbosity of 6."
(tramp-message vec 6 "%s" result)
result))
+(defun tramp-process-running-p (process-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)))
+ (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))
+ (throw 'result t)))))))
+
(defun tramp-read-passwd (proc &optional prompt)
"Read a password from user (compat function).
Consults the auth-source package.