Skip to content

Add atomic-chrome-server-running-p#28

Open
dakrone wants to merge 1 commit intoalpha22jp:masterfrom
dakrone:add-server-running-check
Open

Add atomic-chrome-server-running-p#28
dakrone wants to merge 1 commit intoalpha22jp:masterfrom
dakrone:add-server-running-check

Conversation

@dakrone
Copy link

@dakrone dakrone commented Oct 23, 2017

This adds a method (autoloaded) that can check whether the atomic-chrome server
is running or not.

This will allow someone to do

(when (not (atomic-chrome-server-running-p))
  (atomic-chrome-start-server))

Resolves #18

This adds a method (autoloaded) that can check whether the atomic-chrome server
is running or not.

This will allow someone to do

```emacs-lisp
(when (not (atomic-chrome-server-running-p))
  (atomic-chrome-start-server))
```

Resolves alpha22jp#18
@alpha22jp
Copy link
Owner

@dakrone

This would be a good solution which is independent of OS. I tested it and it works on Linux, but it doesn't appear to work on Windows. atomic-chrome-server-runnning-p returns nil even though atomic-chrome server is already running. Do you find what the matter is?

@dakrone
Copy link
Author

dakrone commented Oct 30, 2017

@alpha22jp hmm okay, I'll have to find a Windows machine and try to reproduce this, thanks for letting me know!

@ztlevi
Copy link

ztlevi commented Nov 8, 2017

    (defun ztlevi-atomic-chrome-server-running-p ()
      (cond ((executable-find "lsof")
             (zerop (call-process "lsof" nil nil nil "-i" ":64292")))
            ((executable-find "netstat") ; Windows
             (zerop (call-process-shell-command "netstat -aon | grep 64292")))))

    (if (ztlevi-atomic-chrome-server-running-p)
        (message "Can't start atomic-chrome server, because port 64292 is already used")
      (atomic-chrome-start-server))))

Hey, netstat works for windows and lsof works for Linux and mac. I see your way doing this, but I doubt that we should kill that process. Because all the time I start another emacs just to test some configuration...Well, that's my case. Not sure about yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants