From: Eshel Yaron Date: Sun, 29 Oct 2023 17:36:48 +0000 (+0100) Subject: Avoid possible race condition with tty top-level creation X-Git-Tag: V9.1.17-0.26.1~1 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3521dc3e7bd4098e472974f93ac292c63005eeb3;p=sweep.git Avoid possible race condition with tty top-level creation * sweeprolog.el (sweeprolog-top-level-buffer): Create the top-level thread before calling stty. --- 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"