From: João Távora Date: Sun, 12 Aug 2018 12:22:27 +0000 (+0100) Subject: Revert "Make jsonrpc-shutdown a noop if process isn't running" X-Git-Tag: emacs-27.0.90~4587 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a5cd6cb2b55a40e3f72e5354d87b3290708f60bf;p=emacs.git 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. --- 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 .") (cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection) &optional cleanup) - "Wait for JSONRPC connection CONN to shutdown and return t. -If the server wasn't running, do nothing and return nil. With -optional CLEANUP, kill any associated buffers. " + "Wait for JSONRPC connection CONN to shutdown. +With optional CLEANUP, kill any associated buffers. " (unwind-protect - (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)) - (when cleanup (kill-buffer (process-buffer (jsonrpc--process 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)) + (when cleanup + (kill-buffer (process-buffer (jsonrpc--process conn)))))) (defun jsonrpc-stderr-buffer (conn) "Get CONN's standard error buffer, if any."