Ensure local default-directory' when calling process-attributes'.

* lisp/server.el (server-running-p):
* lisp/subr.el (memory-limit): Ensure local `default-directory'
when calling `process-attributes'.
This commit is contained in:
Michael Albinus 2022-04-08 12:47:53 +02:00
parent c4921d1157
commit d9851c6df2
2 changed files with 4 additions and 2 deletions

View file

@ -779,7 +779,8 @@ by the current Emacs process, use the `server-process' variable."
(condition-case nil
(if server-use-tcp
(with-temp-buffer
(insert-file-contents-literally (expand-file-name name server-auth-dir))
(setq default-directory server-auth-dir)
(insert-file-contents-literally (expand-file-name name))
(or (and (looking-at "127\\.0\\.0\\.1:[0-9]+ \\([0-9]+\\)")
(assq 'comm
(process-attributes

View file

@ -2719,7 +2719,8 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'."
(defun memory-limit ()
"Return an estimate of Emacs virtual memory usage, divided by 1024."
(or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0))
(let ((default-directory temporary-file-directory))
(or (cdr (assq 'vsize (process-attributes (emacs-pid)))) 0)))
;;;; Input and display facilities.