emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 881e758 1/2: * lisp/textmodes/ispell.el: Check process is live be


From: Reuben Thomas
Subject: master 881e758 1/2: * lisp/textmodes/ispell.el: Check process is live before interacting.
Date: Mon, 28 Jun 2021 08:42:23 -0400 (EDT)

branch: master
commit 881e75873dfb15077413d96c6606bbf042ab0a93
Author: Reuben Thomas <rrt@sc3d.org>
Commit: Reuben Thomas <rrt@sc3d.org>

    * lisp/textmodes/ispell.el: Check process is live before interacting.
    
    Check that `ispell-process' is live before trying to read from or
    write to it. This avoids a hang if the process has died.
---
 lisp/textmodes/ispell.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 4dbc764..84d7208 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1765,10 +1765,12 @@ You can set this variable in hooks in your init file -- 
eg:
 If asynchronous subprocesses are not supported, call function `ispell-filter'
 and pass it the output of the last Ispell invocation."
   (if ispell-async-processp
-      (let ((timeout (if timeout-msecs
-                        (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
-                      timeout-secs)))
-       (accept-process-output ispell-process timeout))
+      (if (process-live-p ispell-process)
+       (let ((timeout (if timeout-msecs
+                         (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+                       timeout-secs)))
+        (accept-process-output ispell-process timeout))
+       (error "No Ispell process to read output from!"))
     (if (null ispell-process)
        (error "No Ispell process to read output from!")
       (let ((buf ispell-output-buffer)
@@ -1793,7 +1795,8 @@ Only works for Aspell and Enchant."
 (defun ispell-send-string (string)
   "Send the string STRING to the Ispell process."
   (if ispell-async-processp
-      (process-send-string ispell-process string)
+      (if (process-live-p ispell-process)
+       (process-send-string ispell-process string))
     ;; Asynchronous subprocesses aren't supported on this losing system.
     ;; We keep all the directives passed to Ispell during the entire
     ;; session in a buffer, and pass them anew each time we invoke



reply via email to

[Prev in Thread] Current Thread [Next in Thread]