|
From: | Zelphir Kaltstahl |
Subject: | Error: Unbound variable: er-no-values |
Date: | Wed, 14 Dec 2022 18:27:55 +0000 |
Hello Geiser Users!
I've hit a strange error, when using paginated output via a pager
and `open-output-pipe` with GNU Guile 3.0.8, installed via GNU
Guix and Emacs `GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+
Version 3.24.30, cairo version 1.16.0)` also installed via GNU
Guix. Here is the GNU Guile code, which I use for paginated
output:
~~~~ (library (paginated-output) (export output-paginated) (import (except (rnrs base) let-values) (only (guile) ;; lambdas lambda* λ ;; control structures when ;; display display simple-format ;; strings string-join string-append string-tokenize ;; characters char-set char-set-complement ;; environment variables getenv ;; path stuff search-path) ;; pipes (ice-9 popen)) ;; `path-as-string->list`'s logic is copied from GNU ;; Guix. Some comments added. See: ;; https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm?id=c0bc08d82c73e464a419f213d5ae5545bc67e2bf#n573. (define path-as-string->list (lambda* (path #:optional (separator #\:)) (if separator (string-tokenize path ;; Match everything except the ;; separator. (char-set-complement (char-set separator))) ;; Otherwise simply return a list containing the ;; path to be sure to always return a list. (list path)))) ;; `find-executable-on-path` is adapted from GNU Guix's ;; `which` procedure. See: ;; https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/utils.scm?id=c0bc08d82c73e464a419f213d5ae5545bc67e2bf#n617 (define (find-executable-on-path executable) "Return the complete file name for EXECUTABLE as found in ${PATH}, or #f if EXECUTABLE could not be found." ;; search-path is a procedure defined in GNU Guile (search-path ;; Check the PATH for the executable. (path-as-string->list (getenv "PATH")) executable)) (define find-pager (λ () (or (getenv "PAGER") (find-executable-on-path "more") (find-executable-on-path "less")))) ;;; Now onto the actual matter of using open-pipe ... (define open-output-pipe* (λ (command . args) (open-output-pipe (string-join (cons command args) " ")))) (define output-paginated (λ (message lines-per-page) (let* ([pager-args ;; Here we assume, that the pager will support ;; an argument "-<number>". This might not always be ;; true. (list (string-append "-" (number->string lines-per-page)))] [pager-pipe ;; Execute the pager command in a subprocess ;; with its arguments and return an output ;; pipe to the pager. (apply open-output-pipe* (find-pager) pager-args)]) (display (simple-format #f "~a\n" message) pager-pipe) ;; Ultimately close pipe after being done with ;; writing to it. (close-pipe pager-pipe))))) ~~~~
When I use this code, I get an error as follows:
~~~~ scheme@(guile-user)> (load "lib/paginated-output.scm") ... scheme@(guile-user)> (import (paginated-output)) scheme@(guile-user)> (output-paginated "a\nb\nc\nd\ne\nf\ng\n" 3) a b c --More-- d ...skipping 1 line f g $8 = done ;;; <unknown-location>: warning: possibly unbound variable `er-no-values' ice-9/boot-9.scm:1685:16: In procedure raise-exception: Unbound variable: er-no-values Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,bt In current input: 112:0 1 (_) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ~~~~
There is no `er-no-values` in my code, so it seems this is something Geiser internal? The backtrace is not really helpful to me either.
I tried adding a `'done` as a return value of `output-paginated`, but that did not change anything.
However, when I instead run an `ansi-term` or `shell` and inside those `guile` and then do the same calls there, I do not get this error.
Could this be an issue of Geiser with pipes?
Best regards,
Zelphir
-- repositories: https://notabug.org/ZelphirKaltstahl
[Prev in Thread] | Current Thread | [Next in Thread] |