diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-08-12 08:53:46 -0400 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-08-28 22:10:20 -0400 |
commit | 697b797160f8145f282767cedd66be2d7297fe1e (patch) | |
tree | 2417616a9bc2f8dd82562c4867dd50a108abfe9e /gnu | |
parent | b096b939f74913cfed5ed3efb5701a9132854760 (diff) | |
download | guix-697b797160f8145f282767cedd66be2d7297fe1e.tar.gz |
marionette: Improve the error message of 'wait-for-screen-text'.
* gnu/build/marionette.scm (wait-for-screen-text): Return the last OCR'd text when the predicate fails to match instead of the not useful predicate object.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/build/marionette.scm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm index 4f409166db..24170bbd30 100644 --- a/gnu/build/marionette.scm +++ b/gnu/build/marionette.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com> +;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -308,13 +309,14 @@ PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded." (define end (+ start timeout)) - (let loop () + (let loop ((last-text #f)) (if (> (car (gettimeofday)) end) - (error "'wait-for-screen-text' timeout" predicate) - (or (predicate (marionette-screen-text marionette #:ocrad ocrad)) - (begin - (sleep 1) - (loop)))))) + (error "'wait-for-screen-text' timeout" 'ocr-text: last-text) + (let ((text (marionette-screen-text marionette #:ocrad ocrad))) + (or (predicate text) + (begin + (sleep 1) + (loop text))))))) (define %qwerty-us-keystrokes ;; Maps "special" characters to their keystrokes. |