More reliably capture the startup message

It still sometimes isn't caught but it is more reliable. This mainly affects
testing.

* jupyter-client.el (jupyter-start-channels): Add a small delay after starting
  channels.

* jupyter-kernel-manager.el (jupyter-start-kernel): Remove superfluous delay.
This commit is contained in:
Nathaniel Nicandro 2018-11-14 18:07:18 -06:00
parent 75abea913d
commit 5a7c083169
2 changed files with 4 additions and 3 deletions

View file

@ -542,7 +542,10 @@ necessary."
(:shell . ,shell)
(:iopub . ,iopub)
(:stdin . ,stdin))
when start do (jupyter-start-channel client channel)))
when start do (jupyter-start-channel client channel))
;; Needed for reliability. Sometimes we are not fast enough to capture the
;; startup message of a kernel.
(sleep-for 0.3))
(cl-defmethod jupyter-stop-channels ((client jupyter-kernel-client))
"Stop any running channels of CLIENT."

View file

@ -189,8 +189,6 @@ kernel. Starting a kernel involves the following steps:
(let ((json-encoding-pretty-print t))
(with-temp-file conn-file
(insert (json-encode-plist conn-info))))
;; This is needed for reliability
(sleep-for 0.5)
;; Start the process
(let ((atime (nth 4 (file-attributes conn-file)))
(proc (jupyter--start-kernel