[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 ff997ad786 1/2: Ensure local `default-directory' in Tramp when
From: |
Michael Albinus |
Subject: |
emacs-28 ff997ad786 1/2: Ensure local `default-directory' in Tramp when needed |
Date: |
Fri, 8 Apr 2022 07:12:40 -0400 (EDT) |
branch: emacs-28
commit ff997ad7863c7c54a12d0cd07fa4c01766dfcce4
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Ensure local `default-directory' in Tramp when needed
* lisp/net/tramp.el (tramp-process-running-p): Ensure local
`default-directory' when calling `list-system-processes' and
`process-attributes'.
---
lisp/net/tramp.el | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a24d83f876..8baf72464d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5666,14 +5666,15 @@ verbosity of 6."
"Return t if system process PROCESS-NAME is running for `user-login-name'."
(when (stringp process-name)
(catch 'result
- (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))
- ;; 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)))))))
+ (let ((default-directory temporary-file-directory))
+ (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))
+ ;; 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))))))))
;; When calling "emacs -Q", `auth-source-search' won't be called. If
;; you want to debug exactly this case, call "emacs -Q --eval '(setq