all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* desktop.el and his lock file
@ 2008-12-02 21:26 Thierry Volpiatto
  2008-12-03  7:19 ` Miles Bader
  0 siblings, 1 reply; 3+ messages in thread
From: Thierry Volpiatto @ 2008-12-02 21:26 UTC (permalink / raw)
  To: emacs-devel

Hi, may be i found a bug in desktop.el:
when killing emacs brutally like with killall or something like that,
emacs when starting again, if desktop is used, use the file
.emacs.desktop.lock (default)
I think emacs should check if the pid that is in this file is always in
use.

here is the code i put after line 967 in desktop.el:

the function is desktop-read
,----
| (if (and owner
|          (eq 0 (call-process-shell-command (format "ps -u %s | grep emacs | grep %d" (getenv "USER") owner)))
|          .....
`----
that seem to work fine here.
May be you can provide something better.
I know there is a variable (`desktop-load-locked-desktop') to avoid
that, but if we forget to set it and we use new feature emacs --daemon,
that can hang the system. (it's what it did this afternoon for me!)
Anyway i will submit a bug also.
Thanks.
-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: desktop.el and his lock file
  2008-12-02 21:26 desktop.el and his lock file Thierry Volpiatto
@ 2008-12-03  7:19 ` Miles Bader
  2008-12-03  7:26   ` Thierry Volpiatto
  0 siblings, 1 reply; 3+ messages in thread
From: Miles Bader @ 2008-12-03  7:19 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-devel

Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
> here is the code i put after line 967 in desktop.el:
>
> the function is desktop-read
> ,----
> | (if (and owner
> |          (eq 0 (call-process-shell-command (format "ps -u %s | grep emacs | grep %d" (getenv "USER") owner)))
> |          .....
> `----

It might be better to use the `signal-process' function with signal
number 0 -- that will just check to see if the process exists and return
an appropriate exit code (0 = exists, -1 = doesn't exist), without
actually sending any signal.

[I guess it won't work on windows, but presumably neither does your
pipeline... :-]

-Miles

-- 
.Numeric stability is probably not all that important when you're guessing.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: desktop.el and his lock file
  2008-12-03  7:19 ` Miles Bader
@ 2008-12-03  7:26   ` Thierry Volpiatto
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Volpiatto @ 2008-12-03  7:26 UTC (permalink / raw)
  To: Miles Bader; +Cc: emacs-devel

Miles Bader <miles@gnu.org> writes:

> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>> here is the code i put after line 967 in desktop.el:
>>
>> the function is desktop-read
>> ,----
>> | (if (and owner
>> |          (eq 0 (call-process-shell-command (format "ps -u %s | grep emacs | grep %d" (getenv "USER") owner)))
>> |          .....
>> `----
>
> It might be better to use the `signal-process' function with signal
> number 0 -- that will just check to see if the process exists and return
> an appropriate exit code (0 = exists, -1 = doesn't exist), without
> actually sending any signal.
>
> [I guess it won't work on windows, but presumably neither does your
> pipeline... :-]

yes:

,----
| (and (system-process-attributes owner)
|      (string-match "emacs"
|                    (cdr (assq 'comm
|                               (system-process-attributes owner)))))
`----

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-03  7:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 21:26 desktop.el and his lock file Thierry Volpiatto
2008-12-03  7:19 ` Miles Bader
2008-12-03  7:26   ` Thierry Volpiatto

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.