atomic-chrome
atomic-chrome copied to clipboard
Add atomic-chrome-server-running-p
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
@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?
@alpha22jp hmm okay, I'll have to find a Windows machine and try to reproduce this, thanks for letting me know!
(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.