>>>>> "J" == John Kaurin <jkaurin / home.com> writes: J> Programming Book. I also wanted any input on whether this J> code might cause problems. Enjoy. It don't work on VMS :-) Something like this perhaps class DevNull def write(*args) end end def trash defout = $defout $defout = DevNull.new yield ensure $defout = defout end J> # Put code that needs to trash $defout or $stdout here. ^^^^^^^^^^ Well, in this case you must do the same thing with $stdout pigeon% cat b.rb #!/usr/bin/ruby def trash begin defout = $defout $defout = File.open('/dev/null', 'w+') yield ensure $defout.reopen(defout) end end trash do $stdout.puts "hello !" end pigeon% b.rb hello ! pigeon% Guy Decoux