jupyter-handle-input-request: Suspend timeouts

See #35.
This commit is contained in:
Nathaniel Nicandro 2019-05-29 00:26:22 -05:00
parent 49275c37b8
commit a5e584e498

View file

@ -768,14 +768,21 @@ PASSWORD is t, then `read-passwd' is used to get input from the
user. Otherwise `read-from-minibuffer' is used." user. Otherwise `read-from-minibuffer' is used."
(declare (indent 1)) (declare (indent 1))
(let* ((value (condition-case nil (let* ((value (condition-case nil
;; Disallow any `with-timeout's from timing out. This
;; prevents any calls to `jupyter-wait-until-received' from
;; timing out when reading input. See #35.
(let ((timeout-spec (with-timeout-suspend)))
(unwind-protect
(if (eq password t) (read-passwd prompt) (if (eq password t) (read-passwd prompt)
(read-from-minibuffer prompt)) (read-from-minibuffer prompt))
(with-timeout-unsuspend timeout-spec)))
(quit ""))) (quit "")))
(msg (jupyter-message-input-reply :value value))) (msg (jupyter-message-input-reply :value value)))
(unwind-protect
(jupyter-send client :stdin :input-reply msg) (jupyter-send client :stdin :input-reply msg)
(if (eq password t) (when (eq password t)
(progn (clear-string value) "") (clear-string value)))
value))) value))
(defalias 'jupyter-handle-input-reply 'jupyter-handle-input-request) (defalias 'jupyter-handle-input-reply 'jupyter-handle-input-request)