[racket] Duplicating output from a system call

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu May 16 16:24:13 EDT 2013

I find that using make-pipe with copy-port works well. Often you need to
create a thread that copies the data to the real port you want it to go to
and then stdout (or whatever) and when you do that, you have to be careful
to make sure ports get closed properly, or else you'll lose data, but it
doesn't take much code and works well.


On Thu, May 16, 2013 at 3:12 PM, Nick Shelley <nickmshelley at gmail.com>wrote:

> I have a script that runs some automated tests and logs the results to the
> console. The tests can take 10+ minutes, so logging steps to the console is
> informative. I'm using Racket to run the script with (system ...) and parse
> the logs and report pass/failure, but to do that I have to capture the
> logs. I spent about an hour in the port docs and can't figure out how to
> both log to the console and capture the logs in Racket for further
> processing (although I'm really good at missing the obvious).
> My current workaround is to use the tee command when running the script
> and then read in and process the file afterwords, but I was wondering if
> there is a more direct way to do this in Racket.
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130516/d6f9993c/attachment.html>

Posted on the users mailing list.