Got it - so if I have to redirect to a file, I could do this - 
(with-output-to-file "output.txt"
  (lambda ()
    (display
     (call-with-input-process
      program
      (lambda (port)
(read-line port #f))))))


Although, I'd like to understand why stdout-redirection: #f outputs to stdout and not the current output port. Is that a problem?

Regards,
Kashyap

On Tue, Mar 20, 2018 at 8:30 AM, Marc Feeley <feeley@iro.umontreal.ca> wrote:
When stdout-redirection: is #f, the output of the process will go to the POSIX stdout.

When it is #t, the output of the process will go to the process port, and you can read from that port to get the output.

For example:

(define program
  (list path: "ls" stdout-redirection: #t arguments: (list "-l")))

(pp
 (call-with-input-process
  program
  (lambda (port)
    (read-line port #f))))

Marc



> On Mar 20, 2018, at 10:28 AM, C K Kashyap <ckkashyap@gmail.com> wrote:
>
> Hello all,
>
> I was hoping for this program to redirect the output of the forked process into a file -
>
> (define program
>   (list path: "ls" stdout-redirection: #f arguments: (list "-l")))
>
> (with-output-to-file
>     (list path: "output.txt")
>   (lambda ()
>     (open-process program)))
>
> But that does not seem to happen. I am not sure what I am missing here.
>
> Regards,
> Kashyap
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list@iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list