branch: elpa/emacsql commit a13eba5f05a03ae865f6e807f3a57c192b353b1c Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Use the timeout argument in emacsql-wait. --- emacsql.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emacsql.el b/emacsql.el index 22f3d1e3ff..fb7e700120 100644 --- a/emacsql.el +++ b/emacsql.el @@ -209,8 +209,10 @@ buffer. This is for debugging purposes." (defun emacsql-wait (conn &optional timeout) "Block Emacs until CONN has finished sending output." - (while (not (emacsql--complete-p conn)) - (accept-process-output (emacsql-process conn)))) + (let ((end (when timeout (+ (float-time) timeout)))) + (while (and (or (null timeout) (< (float-time) end)) + (not (emacsql--complete-p conn))) + (accept-process-output (emacsql-process conn) timeout)))) (defmacro emacsql-with-errors (conn &rest body) "Run BODY checking for errors from SQLite after completion."