unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Stefan Monnier" <monnier@iro.umontreal.ca>
Cc: Ulrich Mueller <ulm@gentoo.org>, emacs-devel@gnu.org
Subject: Re: Lost socket for detached Emacs, how to regain control?
Date: Thu, 6 Nov 2008 10:47:25 +0100	[thread overview]
Message-ID: <f7ccd24b0811060147i7989e88cqc1eb72d124c66735@mail.gmail.com> (raw)
In-Reply-To: <jwvwsfhskth.fsf-monnier+emacs@gnu.org>

On Thu, Nov 6, 2008 at 02:31, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> Another option is for server-start to
> try and detect that there's already an active socket (using
> server-running-p) and refuse to start.

That would be useful even for local servers using TCP sockets, but
server-running-p currently does work only for local sockets.

The following is a simple way to at least know whether there's a
process called Emacs with the same pid that is stored in the
authentication file.

(with-temp-buffer
  (insert-file-contents-literally (expand-file-name server-name
server-auth-dir))
  (skip-chars-forward "0-9:.")
  (let ((case-fold-search t)
        (proc (assq 'comm (system-process-attributes (read (point-marker))))))
    (and proc
         (string-match-p "emacs" (cdr proc)))))

  Juanma




  reply	other threads:[~2008-11-06  9:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04 15:32 Lost socket for detached Emacs, how to regain control? Ulrich Mueller
2008-11-06  1:31 ` Stefan Monnier
2008-11-06  9:47   ` Juanma Barranquero [this message]
2008-11-06 14:15     ` Stefan Monnier
2008-11-06 15:50       ` Juanma Barranquero
2008-11-07  2:15         ` Stefan Monnier
2008-11-07 14:47           ` Juanma Barranquero
2008-11-07  6:48   ` Ulrich Mueller
2008-11-07 14:39     ` Stefan Monnier
2008-11-07 14:54     ` Dan Nicolaescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0811060147i7989e88cqc1eb72d124c66735@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=ulm@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).