This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Re: `expect-strings' and `with-input-from-port'
- To: ttn at glug dot org
- Subject: Re: `expect-strings' and `with-input-from-port'
- From: Allister MacLeod <listopad at mv3d dot com>
- Date: Thu, 23 Mar 2000 16:04:44 -0500
- Cc: guile at sourceware dot cygnus dot com
- References: <200003230557.VAA15874@revel.glug.org>
Apparently it's the (char-ready?) that makes B1 not work. Seems that
it just returns #f all the time for the with-input-from-port version.
I have no idea why that happens, or what you should do if you really
need char-ready? in there.
. On Wed, Mar 22, 2000 at 09:57:46PM -0800, thi wrote:
...
> in the snippet appended below, (A) works, (B1) doesn't, but (B2) does.
> am i doing something wrong here? (this is w/ recent cvs guile.) can
> anyone get (B1) to work?
...
> ;;; A
> (with-input-from-port (open-input-pipe "cat /etc/passwd")
> (lambda ()
> (let loop ((c (read-char)))
> (or (eof-object? c)
> (begin
> (display c)
> (loop (read-char)))))))
>
> ;;; B1
> (with-input-from-port (open-input-pipe "cat /etc/passwd")
> ;;; B2
> ;(with-input-from-file "/etc/passwd"
> (lambda ()
> (let loop ()
> (and (char-ready?)
> (begin
> (expect-strings
> ("^.+$"
> => (lambda all
> (display all)
> (newline))))
> (loop))))))
>
> ;;;;;;;;;;; snippet ends here