mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Shut down jsonrpc server more gracefully
* lisp/jsonrpc.el (jsonrpc-running-p): Avoid unnecessarily killing the server process. Suggested by Aaron Zeng <azeng@janestreet.com>. (Bug#70522)
This commit is contained in:
parent
4e17e0b84a
commit
3aed440025
1 changed files with 5 additions and 2 deletions
|
|
@ -591,15 +591,18 @@ connection object, called when the process dies.")
|
|||
(cl-defmethod jsonrpc-shutdown ((conn jsonrpc-process-connection)
|
||||
&optional cleanup)
|
||||
"Wait for JSONRPC connection CONN to shutdown.
|
||||
With optional CLEANUP, kill any associated buffers."
|
||||
With optional CLEANUP, kill any associated buffers.
|
||||
If CONN is not shutdown within an reasonable amount of time, warn
|
||||
and delete process."
|
||||
(unwind-protect
|
||||
(cl-loop
|
||||
with proc = (jsonrpc--process conn) for i from 0
|
||||
while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
|
||||
unless (zerop i) do
|
||||
(jsonrpc--warn "Sentinel for %s still hasn't run, deleting it!" proc)
|
||||
do
|
||||
(delete-process proc)
|
||||
do
|
||||
;; Let sentinel have a chance to run
|
||||
(accept-process-output nil 0.1))
|
||||
(when cleanup
|
||||
(kill-buffer (process-buffer (jsonrpc--process conn)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue