[racket] Reliably disable/redirect console output

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Mon Oct 17 15:39:55 EDT 2011

You might be better off tracking down the source of these, because:

(1) They might be symptomatic of some bug, such as a port not being 
specified in a write statement, rather than benign.

(2) Someday you might have a bug get useful diagnostic information to 
one of the ports, and you don't want to suppress it, nor to have your 
string port create an additional growing use of resources that could 
complicate your debugging.

Things I would check:

(1) Look in your code for stray top-level forms that produce values, 
such as expressions used for ad hoc testing.  Add "(begin ... (void))" 
if necessary.

(2) Look in your code for code that writes to a port, but is missing an 
optional port argument some place.  This is a common bug.

(3) Look for those same two problems in PLaneT packages that you're using.

(4) Look for a PLaneT package that is saving a reference to one of the 
ports, outside your "parameterize".

(5) If all else fails, the issue could be in core Racket, but I think 
that's less likely than the above.


Posted on the users mailing list.