unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* open-input-pipe messes with output buffers
@ 2002-08-29 18:28 Neale Pickett
  2002-08-29 20:11 ` Thien-Thi Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Neale Pickett @ 2002-08-29 18:28 UTC (permalink / raw)


I'm experiencing some strange behavior using open-input-pipe while
having open output ports.  It seems like whenever I call
open-input-pipe, whatever's in the output buffer gets re-buffered, so I
get an additional copy in the output port.

For example, this guile program:

  (use-modules (ice-9 popen))

  (let ((outp (open-output-file "goo")))
    (display "foobie" outp)
    (newline outp)
    ;;(flush-all-ports)
    (let ((jh (open-input-pipe "/bin/ls")))
      (display (read-line jh) outp)
      (newline outp))
    (display "shoobie" outp)
    (newline outp))

Produces this in the file "goo":

  foobie
  foobie
  a.py
  shoobie

Uncommenting the (flush-all-ports) line does what I expected with it
commented:

  foobie
  a.py
  shoobie

Is this the desired behavior?  It's pretty confusing to me, but I've only
been using guile for a month :)

Thanks

Neale


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: open-input-pipe messes with output buffers
  2002-08-29 18:28 open-input-pipe messes with output buffers Neale Pickett
@ 2002-08-29 20:11 ` Thien-Thi Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Thien-Thi Nguyen @ 2002-08-29 20:11 UTC (permalink / raw)
  Cc: guile-user

   From: Neale Pickett <neale@woozle.org>
   Date: 29 Aug 2002 11:28:39 -0700

   [rebuffering weirdness w/ popen + test case]

   Is this the desired behavior?

older versions of guile did not separate fdes and port handling properly
when doing pipe operations.  guile-1.4.1.8 DTRT, for example.  to try:

 wget http://www.glug.org/tmp/2002-08/guile-1.4.1.8.tar.gz
 tar xzf guile-1.4.1.8.tar.gz
 cd guile-1.4.1.8 && ./configure --prefix /tmp/a/b/c && make install
 alias guile=/tmp/a/b/c/bin/guile

i believe 1.5.x works too, but i don't recommend that for other reasons.

thi


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-08-29 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-29 18:28 open-input-pipe messes with output buffers Neale Pickett
2002-08-29 20:11 ` Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).