emacs-devel
[Top][All Lists]
Advanced

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

Re: error in server-running-p on M$


From: Chetan Pandya
Subject: Re: error in server-running-p on M$
Date: Tue, 9 Dec 2008 23:05:45 -0800 (PST)

I haven't seen earlier messages, but I am glad something is being done here.



--- On Tue, 12/9/08, Stefan Monnier <address@hidden> wrote:


> Looks good, tho see comment below.
> 
> > +  (and (process-contact proc :server)
> > +       (eq (process-status proc) 'closed)
> > +       (ignore-errors (delete-file (process-get proc
> :server-file))))
> >    (server-log (format "Status changed to %s:
> %s" (process-status
> 
> It would be good to keep some comment about the fact that we don't know
> for sure that the file is ours.

It isn't too difficult to check that. Here is a version that checks that the 
file has the same pid.

(let ((server-file (process-get proc :server-file)))
  (with-temp-buffer
    (set-buffer-multibyte nil)
    (insert-file server-file)
    (beginning-of-buffer)
    (end-of-line)
    (skip-chars-backward "0-9")
    (if (eq (read (current-buffer)) (emacs-pid))
        (ignore-errors (delete-file server-file)))))


> > +      (if (not (server-running-p server-name))
> > +     (ignore-errors (delete-file server-file))
> > +   (setq server-mode nil)  ;; already set by the minor
> mode code
> > +   (error "Server %S is already running"
> server-name))
 
> Finally, for the purpose of server-start, we don't
> necessarily care if
> there is a server named "foo" running on some
> other machine, so maybe in
> the server-use-tcp case, if the IP is not 127.0.0.1,
> server-running-p
> might return a special value like `remote' and
> server-start might treat
> it like "not running" (i.e. it will remove the
> server-file).

It is possible for the IP to be 127.0.0.1 and still the server be running on 
another system.

Chetan




reply via email to

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