branch: externals/ess
commit 190ad9d0fbba75ff991a534fd292831eed318484
Author: Lionel Henry <lionel....@gmail.com>
Commit: Lionel Henry <lionel....@gmail.com>

    Fix detection of stale background processes
---
 lisp/ess-inf.el    | 10 +++++-----
 test/ess-test-r.el |  4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/ess-inf.el b/lisp/ess-inf.el
index 2d1fc8be9f..b8cafe807f 100644
--- a/lisp/ess-inf.el
+++ b/lisp/ess-inf.el
@@ -930,12 +930,12 @@ matched."
                        (process-live-p proc)
                        (equal dialect
                               (buffer-local-value 'ess-dialect (process-buffer 
proc)))
+                       ;; Check that we can evaluate in background
+                       ;; before checking for availability to
+                       ;; avoid issues with newline handshakes
+                       (or (not background)
+                           (ess-can-eval-in-background proc))
                        (or ignore-busy
-                           ;; Check that we can evaluate in background
-                           ;; before checking for availability to
-                           ;; avoid issues with newline handshakes
-                           (or (not background)
-                               (ess-can-eval-in-background proc))
                            (inferior-ess-available-p proc)))
               (throw 'found proc))))))))
 
diff --git a/test/ess-test-r.el b/test/ess-test-r.el
index b918ec49a5..c3b1194e92 100644
--- a/test/ess-test-r.el
+++ b/test/ess-test-r.el
@@ -906,7 +906,9 @@ 
https://github.com/emacs-ess/ESS/issues/725#issuecomment-431781558";
 (ert-deftest ess-r-failed-init-disable-bg-eval-test ()
   (with-r-running nil
     (should-error (ess-r--init-error-handler))
-    (should (not (ess-can-eval-in-background)))))
+    (should (not (ess-can-eval-in-background)))
+    (let ((proc (ess-get-current-process)))
+      (should (and proc (not (eq (ess-get-next-available-bg-process) 
proc)))))))
 
 (provide 'ess-test-r)
 

Reply via email to