From 3521dc3e7bd4098e472974f93ac292c63005eeb3 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 29 Oct 2023 18:36:48 +0100 Subject: [PATCH] Avoid possible race condition with tty top-level creation * sweeprolog.el (sweeprolog-top-level-buffer): Create the top-level thread before calling stty. --- sweeprolog.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sweeprolog.el b/sweeprolog.el index 0f56047..adbfe70 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -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" -- 2.39.2