[MacRuby] #1399: Rake exceptions always print a full trace
#1399: Rake exceptions always print a full trace --------------------------------+------------------------------------------- Reporter: joshaber@… | Owner: lsansonetti@… Type: defect | Status: new Priority: major | Milestone: Component: MacRuby | Keywords: --------------------------------+------------------------------------------- The `rake` that comes with MacRuby (both 0.10 and the nightly) seems to always print a full trace when a task raises an exception. For example, if I run: {{{ task :blah do raise Exception, 'whatev' end }}} With MacRuby, I get: {{{ rake aborted! whatev /Volumes/GitHub/Mac/blah/rakefile:2:in `block' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:632:in `block' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:629:in `execute' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:595:in `block' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/monitor.rb:201:in `synchronize' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:588:in `invoke_with_call_chain' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:581:in `invoke' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:2042:in `invoke_task' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:2020:in `block' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:2020:in `block' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:2059:in `standard_exception_handling' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:2014:in `top_level' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/lib/ruby/1.9.2/rake.rb:1993:in `run' /Library/Frameworks/MacRuby.framework/Versions/0.11/usr/bin/macrake:31:in `<main>' }}} If I run with Ruby 1.9.2, I get: {{{ rake aborted! whatev Tasks: TOP => blah (See full trace by running task with --trace) }}} If I use that --trace argument, the output is essentially like MacRuby's. So in other words. MacRuby's `rake` always behaves like Ruby 1.9.2's `rake --trace`. This is pretty annoying when running tests because it's a lot of noise every time I have a failing test. It makes parsing (both for a tool and for me!) harder since I have to ignore all the useless stack trace. -- Ticket URL: <http://www.macruby.org/trac/ticket/1399> MacRuby <http://macruby.org/>
#1399: Rake exceptions always print a full trace --------------------------------+------------------------------------------- Reporter: joshaber@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: invalid Keywords: | --------------------------------+------------------------------------------- Changes (by watson1978@…): * status: new => closed * resolution: => invalid Comment: CRuby19 p290's rake (version 0.8.7) always display trace logs as well the MacRuby in my environment. {{{ $ cat test_rake.rake task :blah do raise Exception, 'whatev' end $ rake19 --version rake, version 0.8.7 $ rake19 -f test_rake.rake (in /Users/watson/tmp) rake aborted! Don't know how to build task 'default' /usr/local/lib/ruby/1.9.1/rake.rb:1720:in `[]' /usr/local/lib/ruby/1.9.1/rake.rb:2040:in `invoke_task' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' /usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level' /usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run' /usr/local/bin/rake19:31:in `<main>' }}} To hide the traces, I think the following changes are required. Or, update macrake to 0.9.2. {{{ diff --git a/lib/rake.rb b/lib/rake.rb index 36ca077..52d9ef7 100755 --- a/lib/rake.rb +++ b/lib/rake.rb @@ -2067,7 +2067,7 @@ module Rake # Exit with error message $stderr.puts "#{name} aborted!" $stderr.puts ex.message - if options.trace or true + if options.trace $stderr.puts ex.backtrace.join("\n") else $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || "" }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/1399#comment:4> MacRuby <http://macruby.org/>
#1399: Rake exceptions always print a full trace --------------------------------+------------------------------------------- Reporter: joshaber@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: Component: MacRuby | Resolution: invalid Keywords: | --------------------------------+------------------------------------------- Comment(by mrada@…): I wonder if it is too late to upgrade rake for MacRuby 0.11 -- Ticket URL: <http://www.macruby.org/trac/ticket/1399#comment:5> MacRuby <http://macruby.org/>
#1399: Rake exceptions always print a full trace --------------------------------+------------------------------------------- Reporter: joshaber@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: major | Milestone: MacRuby 0.11 Component: MacRuby | Resolution: invalid Keywords: | --------------------------------+------------------------------------------- Changes (by eloy.de.enige@…): * milestone: => MacRuby 0.11 Comment: @Watson I’ve just pushed your fix: https://github.com/MacRuby/MacRuby/commit/dfeb89e6dcb023907f11751ed44bebd3b7.... @Mark Please ask Laurent what he thinks about updating rake before/after 0.11. -- Ticket URL: <http://www.macruby.org/trac/ticket/1399#comment:6> MacRuby <http://macruby.org/>
participants (1)
-
MacRuby