[PATCH] test: test-lib.el: replace sleep-for with sit-for in notmuch-test-wait

Tomi Ollila tomi.ollila at iki.fi
Fri Aug 3 05:16:03 PDT 2012


The function `notmuch-test-wait` called `get-buffer-process` and
`sleep-for` in a loop. On some emacses neither of these cause emacs
to check whether the process has exited and update it's status
accordingly. In this case the loop does not exit.

The function `sit-for` goes into event loop via `read-event` function
call. `read-event` does not return when process exits but the event
loop used to determine whether there is keyboard, mouse, etc. event
updates the process status as a side effect of the (more generic)
event loop. `sit-for` is used here to restore the event into queue
in the improbable case `read-event` consumes an event.
---
 test/test-lib.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/test/test-lib.el b/test/test-lib.el
index 5dd6271..d14246a 100644
--- a/test/test-lib.el
+++ b/test/test-lib.el
@@ -38,7 +38,8 @@
 (defun notmuch-test-wait ()
   "Wait for process completion."
   (while (get-buffer-process (current-buffer))
-    (sleep-for 0.1)))
+    ;; sit-for visits event loop for process exit notification.
+    (sit-for 0.1)))
 
 (defun test-output (&optional filename)
   "Save current buffer to file FILENAME.  Default FILENAME is OUTPUT."
-- 
1.7.1



More information about the notmuch mailing list