<div dir="ltr">Got it - so if I have to redirect to a file, I could do this - <div><div>(with-output-to-file "output.txt"</div><div>  (lambda ()</div><div>    (display</div><div>     (call-with-input-process</div><div>      program</div><div>      (lambda (port)</div><div><span style="white-space:pre">      </span>(read-line port #f))))))</div></div><div><br></div><div><br></div><div>Although, I'd like to understand why stdout-redirection: #f outputs to stdout and not the current output port. Is that a problem?</div><div><br></div><div>Regards,</div><div>Kashyap</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 20, 2018 at 8:30 AM, Marc Feeley <span dir="ltr"><<a href="mailto:feeley@iro.umontreal.ca" target="_blank">feeley@iro.umontreal.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When stdout-redirection: is #f, the output of the process will go to the POSIX stdout.<br>
<br>
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.<br>
<br>
For example:<br>
<br>
(define program<br>
  (list path: "ls" stdout-redirection: #t arguments: (list "-l")))<br>
<br>
(pp<br>
 (call-with-input-process<br>
  program<br>
  (lambda (port)<br>
    (read-line port #f))))<br>
<br>
Marc<br>
<div><div class="h5"><br>
<br>
<br>
> On Mar 20, 2018, at 10:28 AM, C K Kashyap <<a href="mailto:ckkashyap@gmail.com">ckkashyap@gmail.com</a>> wrote:<br>
><br>
> Hello all,<br>
><br>
> I was hoping for this program to redirect the output of the forked process into a file -<br>
><br>
> (define program<br>
>   (list path: "ls" stdout-redirection: #f arguments: (list "-l")))<br>
><br>
> (with-output-to-file<br>
>     (list path: "output.txt")<br>
>   (lambda ()<br>
>     (open-process program)))<br>
><br>
> But that does not seem to happen. I am not sure what I am missing here.<br>
><br>
> Regards,<br>
> Kashyap<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> Gambit-list mailing list<br>
> <a href="mailto:Gambit-list@iro.umontreal.ca">Gambit-list@iro.umontreal.ca</a><br>
> <a href="https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list" rel="noreferrer" target="_blank">https://webmail.iro.umontreal.<wbr>ca/mailman/listinfo/gambit-<wbr>list</a><br>
<br>
</blockquote></div><br></div>