Skip to content

Commit ff997ad

Browse files
committed
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'.
1 parent 4f27588 commit ff997ad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lisp/net/tramp.el

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5666,14 +5666,15 @@ verbosity of 6."
56665666
"Return t if system process PROCESS-NAME is running for `user-login-name'."
56675667
(when (stringp process-name)
56685668
(catch 'result
5669-
(dolist (pid (list-system-processes))
5670-
(when-let ((attributes (process-attributes pid))
5671-
(comm (cdr (assoc 'comm attributes))))
5672-
(and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
5673-
;; The returned command name could be truncated to 15
5674-
;; characters. Therefore, we cannot check for `string-equal'.
5675-
(string-prefix-p comm process-name)
5676-
(throw 'result t)))))))
5669+
(let ((default-directory temporary-file-directory))
5670+
(dolist (pid (list-system-processes))
5671+
(when-let ((attributes (process-attributes pid))
5672+
(comm (cdr (assoc 'comm attributes))))
5673+
(and (string-equal (cdr (assoc 'user attributes)) (user-login-name))
5674+
;; The returned command name could be truncated to 15
5675+
;; characters. Therefore, we cannot check for `string-equal'.
5676+
(string-prefix-p comm process-name)
5677+
(throw 'result t))))))))
56775678

56785679
;; When calling "emacs -Q", `auth-source-search' won't be called. If
56795680
;; you want to debug exactly this case, call "emacs -Q --eval '(setq

0 commit comments

Comments
 (0)