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.
This commit is contained in:
parent
b096b939f7
commit
697b797160
1 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2016-2022 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
|
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
|
||||||
|
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -308,13 +309,14 @@ PREDICATE, whichever comes first. Raise an error when TIMEOUT is exceeded."
|
||||||
(define end
|
(define end
|
||||||
(+ start timeout))
|
(+ start timeout))
|
||||||
|
|
||||||
(let loop ()
|
(let loop ((last-text #f))
|
||||||
(if (> (car (gettimeofday)) end)
|
(if (> (car (gettimeofday)) end)
|
||||||
(error "'wait-for-screen-text' timeout" predicate)
|
(error "'wait-for-screen-text' timeout" 'ocr-text: last-text)
|
||||||
(or (predicate (marionette-screen-text marionette #:ocrad ocrad))
|
(let ((text (marionette-screen-text marionette #:ocrad ocrad)))
|
||||||
(begin
|
(or (predicate text)
|
||||||
(sleep 1)
|
(begin
|
||||||
(loop))))))
|
(sleep 1)
|
||||||
|
(loop text)))))))
|
||||||
|
|
||||||
(define %qwerty-us-keystrokes
|
(define %qwerty-us-keystrokes
|
||||||
;; Maps "special" characters to their keystrokes.
|
;; Maps "special" characters to their keystrokes.
|
||||||
|
|
Reference in a new issue