From: Tom Spilman Date: 2001-05-27T04:10:05+09:00 Subject: [ruby-talk:15771] Re: Disabling stderr > > > > nulFile = File.open('nul', 'w') # UNIX: nulFile = > > > > File.open('/dev/null', 'w') > > > > STDERR = nulFile > > Why don't you do STDERR.reopen "/dev/null","w" ? Yea reopen would be the better way if that were the method i'd chosen. I'm testing ruby for possible embedding into our game and i was trying to find a way to disable stderr output for compiler errors at the C/C++ level and not within the script itself. 'rb_eval_string_protect' as Guy Decoux suggested does exactly what i was looking for. Tom "Mathieu Bouchard" wrote in message news:Pine.LNX.3.96.1010526133330.2769A-100000@relayer... > > I've got a adequate fix that will work for me for now, but i'd really > > like to see this behavior controllable thru the ruby api. What i've done is > > wrap the call to 'rb_eval_string'... > > freopen( "nul", "a", stderr ); > [...] > > > > nulFile = File.open('nul', 'w') # UNIX: nulFile = > > > > File.open('/dev/null', 'w') > > > > STDERR = nulFile > > Why don't you do STDERR.reopen "/dev/null","w" ? > > matju > >