Redirect stdout

FYI, for Win32 you can redirect to “nul” or “nul:”. Yes, that’s a
single ‘l’.

Regards,

Dan

···

-----Original Message-----
From: Reimer Behrends [mailto:behrends@cse.msu.edu]
Sent: Monday, November 24, 2003 8:52 AM
To: ruby-talk ML
Subject: Re: redirect stdout

T. Onoma (transami@runbox.com) wrote:

I need to temporarily redirect standard output to nowhere.
Not sure
how to do.

Assuming you run some *IX:

STDOUT.reopen “/dev/null”, “w”

will redirect the standard output (including not just Ruby
output, but even the output of subprocesses) to /dev/null.

  	Reimer Behrends