emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c580443 1/2: Make jsonrpc-shutdown a noop if proces


From: João Távora
Subject: [Emacs-diffs] master c580443 1/2: Make jsonrpc-shutdown a noop if process isn't running
Date: Sat, 11 Aug 2018 09:57:51 -0400 (EDT)

branch: master
commit c580443325a3d071625185876a8f28e04793c625
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Make jsonrpc-shutdown a noop if process isn't running
    
    * lisp/jsonrpc.el
    (Version): Bump to 1.0.4
    (jsonrpc-shutdown): Noop if server isn't running.
---
 lisp/jsonrpc.el | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index f3e0982..b41c30c 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -6,7 +6,7 @@
 ;; Maintainer: João Távora <address@hidden>
 ;; Keywords: processes, languages, extensions
 ;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.3
+;; Version: 1.0.4
 
 ;; This is an Elpa :core package.  Don't use functionality that is not
 ;; compatible with Emacs 25.2.
@@ -412,15 +412,18 @@ connection object, called when the process dies .")
   (process-live-p (jsonrpc--process conn)))
 
 (cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection))
-  "Shutdown the JSONRPC connection CONN."
-  (cl-loop
-   with proc = (jsonrpc--process conn)
-   do
-   (delete-process proc)
-   (accept-process-output nil 0.1)
-   while (not (process-get proc 'jsonrpc-sentinel-done))
-   do (jsonrpc--warn
-       "Sentinel for %s still hasn't run,  deleting it!" proc)))
+  "Wait for JSONRPC connection CONN to shutdown and return t.
+If the server wasn't running, do nothing and return nil."
+  (when (jsonrpc-running-p conn)
+    (cl-loop
+     with proc = (jsonrpc--process conn)
+     do
+     (delete-process proc)
+     (accept-process-output nil 0.1)
+     while (not (process-get proc 'jsonrpc-sentinel-done))
+     do (jsonrpc--warn
+         "Sentinel for %s still hasn't run,  deleting it!" proc)
+     finally return t)))
 
 (defun jsonrpc-stderr-buffer (conn)
   "Get CONN's standard error buffer, if any."



reply via email to

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