guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

open-input-pipe messes with output buffers


From: Neale Pickett
Subject: open-input-pipe messes with output buffers
Date: 29 Aug 2002 11:28:39 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]