[MacRuby] #576: It's possible to close STDOUT (and presumably other standard IO streams)
#576: It's possible to close STDOUT (and presumably other standard IO streams) -----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Run the following in irb, then macirb: {{{ STDOUT.close }}} '''Expected (Ruby 1.9.1):''' {{{ => nil }}} '''Actual (MacRuby 0.5 beta 2):''' {{{ (closes interpreter) }}} The expected behavior is to ignore close requests to standard IO streams. Ruby does this, but MacRuby does not. When using macirb, calling {{{STDOUT.close}}} simply closes the interpreter, whereas in Ruby it returns nil. This has important real-world implications when dealing with logging. Consider logging to STDOUT; Logger#close actually closes the STDOUT stream! -- Ticket URL: <http://www.macruby.org/trac/ticket/576> MacRuby <http://macruby.org/>
#576: It's possible to close STDOUT (and presumably other standard IO streams) -----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by danielcavanagh@…): very simple implementation: just checks for the original stdout, stderr, and stdin within io_close() and ignores them -- Ticket URL: <http://www.macruby.org/trac/ticket/576#comment:2> MacRuby <http://macruby.org/>
#576: It's possible to close STDOUT (and presumably other standard IO streams) -----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by matthew@…): Awesome, thanks Daniel. -- Ticket URL: <http://www.macruby.org/trac/ticket/576#comment:3> MacRuby <http://macruby.org/>
#576: It's possible to close STDOUT (and presumably other standard IO streams) -----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by matthew@…): Actually I just tried this on the latest revision of 1.9.1 (p376) and I get this instead: {{{ $ irb irb(main):001:0> STDOUT.close /usr/local/lib/ruby/1.9.1/irb.rb:166:in `write': closed stream (IOError) from /usr/local/lib/ruby/1.9.1/irb.rb:166:in `print' from /usr/local/lib/ruby/1.9.1/irb.rb:166:in `block (2 levels) in eval_input' from /usr/local/lib/ruby/1.9.1/irb.rb:271:in `signal_status' from /usr/local/lib/ruby/1.9.1/irb.rb:154:in `block in eval_input' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb.rb:153:in `eval_input' from /usr/local/lib/ruby/1.9.1/irb.rb:70:in `block in start' from /usr/local/lib/ruby/1.9.1/irb.rb:69:in `catch' from /usr/local/lib/ruby/1.9.1/irb.rb:69:in `start' from /usr/local/bin/irb:12:in `<main>' }}} So it seems that it is now possible? Maybe this is not an issue. Incidentally, in the latest 1.9.1 the Logger library breaks in the same way if logging to STDOUT and sent a close message. -- Ticket URL: <http://www.macruby.org/trac/ticket/576#comment:4> MacRuby <http://macruby.org/>
I get the same IOError when I try to STDOUT.close from IRB. On Sat, Feb 6, 2010 at 12:05 PM, MacRuby <ruby-noreply@macosforge.org>wrote:
#576: It's possible to close STDOUT (and presumably other standard IO streams)
-----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords:
-----------------------------------+----------------------------------------
Comment(by matthew@…):
Actually I just tried this on the latest revision of 1.9.1 (p376) and I get this instead:
{{{ $ irb irb(main):001:0> STDOUT.close /usr/local/lib/ruby/1.9.1/irb.rb:166:in `write': closed stream (IOError) from /usr/local/lib/ruby/1.9.1/irb.rb:166:in `print' from /usr/local/lib/ruby/1.9.1/irb.rb:166:in `block (2 levels) in eval_input' from /usr/local/lib/ruby/1.9.1/irb.rb:271:in `signal_status' from /usr/local/lib/ruby/1.9.1/irb.rb:154:in `block in eval_input' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:244:in `block (2 levels) in each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `loop' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:230:in `block in each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `catch' from /usr/local/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `each_top_level_statement' from /usr/local/lib/ruby/1.9.1/irb.rb:153:in `eval_input' from /usr/local/lib/ruby/1.9.1/irb.rb:70:in `block in start' from /usr/local/lib/ruby/1.9.1/irb.rb:69:in `catch' from /usr/local/lib/ruby/1.9.1/irb.rb:69:in `start' from /usr/local/bin/irb:12:in `<main>' }}}
So it seems that it is now possible? Maybe this is not an issue.
Incidentally, in the latest 1.9.1 the Logger library breaks in the same way if logging to STDOUT and sent a close message.
-- Ticket URL: <http://www.macruby.org/trac/ticket/576#comment:4> MacRuby <http://macruby.org/>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-- --Brains.
#576: It's possible to close STDOUT (and presumably other standard IO streams) -----------------------------------+---------------------------------------- Reporter: matthew@… | Owner: lsansonetti@… Type: defect | Status: new Priority: critical | Milestone: MacRuby 0.5 Component: MacRuby | Keywords: -----------------------------------+---------------------------------------- Comment(by martinlagardette@…): Laurent, should we close this as Invalid / Won't Fix, as this seems to almost follow ruby19 behavior? The only difference is that MacRuby closes STDOUT and IRB quits, ruby19 exits with the exception paster by matthew, but I guess this is just IRB stuff. -- Ticket URL: <http://www.macruby.org/trac/ticket/576#comment:5> MacRuby <http://macruby.org/>
participants (2)
-
MacRuby
-
Timothy McDowell