From: Michael Albinus Date: Fri, 8 Apr 2022 10:47:53 +0000 (+0200) Subject: Ensure local `default-directory' when calling `process-attributes'. X-Git-Tag: emacs-29.0.90~1931^2~706 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d9851c6df2d5b5e950329968ac268a06ef4adfbf;p=emacs.git 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'. --- diff --git a/lisp/server.el b/lisp/server.el index da60f1cda77..763cf27f7ac 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -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 diff --git a/lisp/subr.el b/lisp/subr.el index 34f7bb6888a..e7d5d36461c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -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.