On Tue, 10 Feb 2004 20:20:03 +0900
In article <pan.2004.02.10.11.14.38.972811 / adslhome.dk>
[capture stderr]
Simon Strandgaard <neoneye / adslhome.dk> wrote:

> I want to temporarily capture stderr output.

No need to reopen. Just assign StringIO.


require 'stringio'

e = StringIO.new
$stderr = e
warn "hello"
$stderr = STDERR

p e.string  # => "hello\n"


--[ Tietew ]-------------------------------------------------------
Mail: tietew / tietew.net / tietew / raug.net
Web : http://www.tietew.net/  (Tietew Windows Lab.)
PGP fingerprint: 26CB 71BB B595 09C4 0153  81C4 773C 963A D51B 8CAA