bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#1474: 23.0.60; desktop.el don't check if pid in his lock file is alw


From: Eli Zaretskii
Subject: bug#1474: 23.0.60; desktop.el don't check if pid in his lock file is always in use
Date: Mon, 27 Apr 2020 17:50:09 +0300

> From: Stefan Kangas <stefan@marxist.se>
> Cc: emacs@gentoo.org,  1474@debbugs.gnu.org,  thierry.volpiatto@gmail.com
> Date: Mon, 27 Apr 2020 12:34:08 +0200
> 
> >> +(defun desktop--emacs-pid-running-p (pid)
> >> +  "Return t if an Emacs process with PID exists."
> >> +  (when-let ((attr (process-attributes pid)))
> >> +    (string-match "^emacs$" (alist-get 'comm attr))))
> >
> > I understand the rationale for the string-match test, but what if the
> > executable file name of Emacs was "transformed", per the
> > '--program-transform-name' option of the configure script?  And even
> > if it wasn't transformed, this will not match emacs-XX.YY and
> > emacs.exe.
> 
> Good point.  But would you suggest to use no check at all, or is there
> some other check we could reasonably use?  I assume it is impossible
> to use the process name due to '--program-transform-name'.

Perhaps you could use the name you find in command-line-args?  Note
that it might include leading directories, and at least on Windows the
directory separator might either be a slash or a backslash, so use of
file-name-nondirectory is advised.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]