[gambit-list] Process stdout redirection

Marc Feeley feeley at iro.umontreal.ca
Tue Mar 20 11:30:13 EDT 2018


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 at 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 at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list




More information about the Gambit-list mailing list