diff options
| author | Michael Albinus | 2022-04-08 13:12:03 +0200 |
|---|---|---|
| committer | Michael Albinus | 2022-04-08 13:12:03 +0200 |
| commit | ff997ad7863c7c54a12d0cd07fa4c01766dfcce4 (patch) | |
| tree | 43770a2a6a1d67465dee00fa8442400a47705753 | |
| parent | 4f27588a16a8ce65db1aa5adfeca12bcbf44af3d (diff) | |
| download | emacs-ff997ad7863c7c54a12d0cd07fa4c01766dfcce4.tar.gz emacs-ff997ad7863c7c54a12d0cd07fa4c01766dfcce4.zip | |
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'.
| -rw-r--r-- | lisp/net/tramp.el | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a24d83f876a..8baf72464dc 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -5666,14 +5666,15 @@ verbosity of 6." | |||
| 5666 | "Return t if system process PROCESS-NAME is running for `user-login-name'." | 5666 | "Return t if system process PROCESS-NAME is running for `user-login-name'." |
| 5667 | (when (stringp process-name) | 5667 | (when (stringp process-name) |
| 5668 | (catch 'result | 5668 | (catch 'result |
| 5669 | (dolist (pid (list-system-processes)) | 5669 | (let ((default-directory temporary-file-directory)) |
| 5670 | (when-let ((attributes (process-attributes pid)) | 5670 | (dolist (pid (list-system-processes)) |
| 5671 | (comm (cdr (assoc 'comm attributes)))) | 5671 | (when-let ((attributes (process-attributes pid)) |
| 5672 | (and (string-equal (cdr (assoc 'user attributes)) (user-login-name)) | 5672 | (comm (cdr (assoc 'comm attributes)))) |
| 5673 | ;; The returned command name could be truncated to 15 | 5673 | (and (string-equal (cdr (assoc 'user attributes)) (user-login-name)) |
| 5674 | ;; characters. Therefore, we cannot check for `string-equal'. | 5674 | ;; The returned command name could be truncated to 15 |
| 5675 | (string-prefix-p comm process-name) | 5675 | ;; characters. Therefore, we cannot check for `string-equal'. |
| 5676 | (throw 'result t))))))) | 5676 | (string-prefix-p comm process-name) |
| 5677 | (throw 'result t)))))))) | ||
| 5677 | 5678 | ||
| 5678 | ;; When calling "emacs -Q", `auth-source-search' won't be called. If | 5679 | ;; When calling "emacs -Q", `auth-source-search' won't be called. If |
| 5679 | ;; you want to debug exactly this case, call "emacs -Q --eval '(setq | 5680 | ;; you want to debug exactly this case, call "emacs -Q --eval '(setq |