aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2018-08-12 13:22:27 +0100
committerJoão Távora2018-08-12 13:25:05 +0100
commita5cd6cb2b55a40e3f72e5354d87b3290708f60bf (patch)
tree70e9cb141d1e5e9a09da83917b193dc9aa8c435e
parenta04829d1b498fd63c534acae629580822ec66a7a (diff)
downloademacs-a5cd6cb2b55a40e3f72e5354d87b3290708f60bf.tar.gz
emacs-a5cd6cb2b55a40e3f72e5354d87b3290708f60bf.zip
Revert "Make jsonrpc-shutdown a noop if process isn't running"
This reverts commit c580443325a3d071625185876a8f28e04793c625. It leads to situations where the sentinel hasn't run yet, which brings problems if the normal process isn't running, but the stderr pseudo-process still is. * lisp/jsonrpc.el (jsonrpc-shutdown): Always enter loop.
-rw-r--r--lisp/jsonrpc.el26
1 files changed, 12 insertions, 14 deletions
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 43b570cfd92..3d88bbf67c9 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -417,21 +417,19 @@ connection object, called when the process dies .")
417 417
418(cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection) 418(cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection)
419 &optional cleanup) 419 &optional cleanup)
420 "Wait for JSONRPC connection CONN to shutdown and return t. 420 "Wait for JSONRPC connection CONN to shutdown.
421If the server wasn't running, do nothing and return nil. With 421With optional CLEANUP, kill any associated buffers. "
422optional CLEANUP, kill any associated buffers. "
423 (unwind-protect 422 (unwind-protect
424 (when (jsonrpc-running-p conn) 423 (cl-loop
425 (cl-loop 424 with proc = (jsonrpc--process conn)
426 with proc = (jsonrpc--process conn) 425 do
427 do 426 (delete-process proc)
428 (delete-process proc) 427 (accept-process-output nil 0.1)
429 (accept-process-output nil 0.1) 428 while (not (process-get proc 'jsonrpc-sentinel-done))
430 while (not (process-get proc 'jsonrpc-sentinel-done)) 429 do (jsonrpc--warn
431 do (jsonrpc--warn 430 "Sentinel for %s still hasn't run, deleting it!" proc))
432 "Sentinel for %s still hasn't run, deleting it!" proc) 431 (when cleanup
433 finally return t)) 432 (kill-buffer (process-buffer (jsonrpc--process conn))))))
434 (when cleanup (kill-buffer (process-buffer (jsonrpc--process conn))))))
435 433
436(defun jsonrpc-stderr-buffer (conn) 434(defun jsonrpc-stderr-buffer (conn)
437 "Get CONN's standard error buffer, if any." 435 "Get CONN's standard error buffer, if any."