[racket] Reliably disable/redirect console output
It's possible that the output happens when the main module's requires
are executed. Or another module might be capturing the initial output or
error port.
Try creating a new module that sets the ports and then dynamic-requires
your main program:
#lang racket/base
(require racket/port)
(current-output-port (open-output-nowhere))
(dynamic-require "your-main-module.rkt" #f)
A trick for hunting down the source of the output is to create a custom
port (see make-output-port) that always raises an error on write. The
stack trace might help you narrow down the source of the outputs. Simply
closing the initial output port might have the same effect; I haven't
tried it.
Ryan
On 10/17/2011 01:21 PM, Erich Rast wrote:
>
> Is it possible to reliably disable/supress or redirect the console error
> and the ordinary output in a GRacket application?
>
> I tried:
>
> (let ((out (open-output-string))
> (err (open-output-string)))
> (parameterize ((current-output-port out)
> (current-error-port err))
> ...))
>
> at the topmost place that opens the first window but it doesn't work, at
> least not in each and every case (why not?)
>
> I have an application that on windows outputs one or two #t whose origin
> are a bit hard to track down in all the source modules, which means that
> a console window shows up on Windows every time.
>
>
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users