On 24 February 2012 01:16, Thien-Thi Nguyen <t...@gnuvola.org> wrote: > () Tristan Colgate <tcolg...@gmail.com> > () Thu, 23 Feb 2012 14:26:28 +0000 > > I tried using open-input-output-pipe but hit issues. > > What were the issues? >
Not sure if this is similar to the OP's issue… Some programs wait until their stdin is closed before producing any output--gzip is a good example. open-pipe is insufficient for this because (close-output-port pipe) closes both ends. This looks more like a limitation of soft-port than open-pipe: scheme@(guile-user)> (use-modules (ice-9 popen)) scheme@(guile-user)> (define pipe (open-pipe "gzip" OPEN_BOTH)) scheme@(guile-user)> (display "foo\n" pipe) scheme@(guile-user)> (force-output pipe) scheme@(guile-user)> (drain-input pipe) $7 = "" scheme@(guile-user)> (close-output-port pipe) scheme@(guile-user)> (drain-input pipe) ERROR: In procedure drain-input: ERROR: In procedure drain-input: Wrong type argument in position 1 (expecting open input port): #<closed: soft 0> Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. scheme@(guile-user) [1]> ,q scheme@(guile-user)> (close-pipe pipe) $8 = 36096 I ended up using run-with-pipe from guile-lib's (os process) module which returns separate port objects--similar to the OP's proc..