Make tramp-interrupt-process more robust

* lisp/net/tramp.el (tramp-interrupt-process): Fall back to
the default implementation if there's no success.
This commit is contained in:
Michael Albinus 2017-12-11 09:36:23 +01:00
parent 5bcd468a9e
commit 6a6e8e6e8d

View file

@ -4570,14 +4570,14 @@ Only works for Bourne-like shells."
'tramp-send-command 'tramp-send-command
(tramp-get-connection-property proc "vector" nil) (tramp-get-connection-property proc "vector" nil)
(format "kill -2 %d" pid)) (format "kill -2 %d" pid))
;; Wait, until the process has disappeared. ;; Wait, until the process has disappeared. If it doesn't,
(with-timeout ;; fall back to the default implementation.
(1 (tramp-error proc 'error "Process %s did not interrupt" proc)) (with-timeout (1 (ignore))
(while (process-live-p proc) (while (process-live-p proc)
;; We cannot run `tramp-accept-process-output', it blocks timers. ;; We cannot run `tramp-accept-process-output', it blocks timers.
(accept-process-output proc 0.1))) (accept-process-output proc 0.1))
;; Report success. ;; Report success.
proc)))) proc)))))
;; `interrupt-process-functions' exists since Emacs 26.1. ;; `interrupt-process-functions' exists since Emacs 26.1.
(when (boundp 'interrupt-process-functions) (when (boundp 'interrupt-process-functions)