]> git.eshelyaron.com Git - sweep.git/commitdiff
Avoid possible race condition with tty top-level creation
authorEshel Yaron <me@eshelyaron.com>
Sun, 29 Oct 2023 17:36:48 +0000 (18:36 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 29 Oct 2023 17:36:48 +0000 (18:36 +0100)
* sweeprolog.el (sweeprolog-top-level-buffer): Create the top-level
thread before calling stty.

sweeprolog.el

index 0f56047d02717764b11c590481001ea4764bc030..adbfe701590235fd09d68c5ffc0ed954e6253aaf 100644 (file)
@@ -3433,11 +3433,12 @@ top-level."
                     (make-comint-in-buffer "sweeprolog-top-level" buf nil)
                     (let* ((proc (get-buffer-process buf))
                            (tty (process-tty-name proc)))
+                      (process-send-eof proc)
+                      (sweeprolog--query-once "sweep" "sweep_top_level_start_pty" tty)
+                      (unless comint-last-prompt buf (accept-process-output proc 1))
                       (when (eq system-type 'gnu/linux)
                         ;; make sure the pty does not echo input
-                        (call-process "stty" nil nil nil "-F" tty "-echo"))
-                      (process-send-eof proc)
-                      (sweeprolog--query-once "sweep" "sweep_top_level_start_pty" tty)))
+                        (call-process "stty" nil nil nil "-F" tty "-echo"))))
                 (unless sweeprolog-prolog-server-port
                   (sweeprolog-start-prolog-server))
                 (make-comint-in-buffer "sweeprolog-top-level"