jsonrpc-shutdown: Ensure we wait whole timeout & increase timeout

* lisp/jsonrpc.el (jsonrpc-shutdown): Ensure that we wait for
the whole timeout and increase the timeout to 300ms (bug#80140).
This commit is contained in:
João Távora 2026-05-28 01:19:24 +01:00 committed by Sean Whitton
parent eb814fbb5c
commit 4f6b6f462c

View file

@ -678,14 +678,16 @@ If CONN is not shutdown within a reasonable amount of time, warn
and delete the network process."
(unwind-protect
(cl-loop
with proc = (jsonrpc--process conn) for i from 0
with proc = (jsonrpc--process conn)
with grace = 0.3 with start = (float-time)
for i from 0
while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
unless (zerop i) do
unless (or (zerop i) (< (- (float-time) start) grace)) do
(jsonrpc--warn "Sentinel for %s still hasn't run, deleting it!" proc)
(delete-process proc)
do
;; Let sentinel have a chance to run
(accept-process-output nil 0.1))
(accept-process-output nil grace))
(when cleanup
(kill-buffer (process-buffer (jsonrpc--process conn)))
(kill-buffer (jsonrpc-stderr-buffer conn)))))