Hi, Eric. And that is the root of the problem. On *nix rake returns 1 on Windows - 0 exit code. Is here any Rake guys who could explain this strange behaviour?
I've added patch that cures tests. There you could find another issue. See test/test_gem_ext_rake_builder.rb windows redirector adds all STDERR output to the end of STDOUT output. So order of "fail" words changed. On 12/23/06, Eric Hodel <[EMAIL PROTECTED]> wrote:
On Dec 22, 2006, at 02:39, Anatol Pomozov wrote: > On 12/22/06, Eric Hodel <[EMAIL PROTECTED]> wrote: > On Dec 21, 2006, at 03:05, Anatol Pomozov wrote: > > On 12/20/06, Cerberus < [EMAIL PROTECTED]> wrote: > > 1) Failure: > > test_class_build_fail(TestGemExtRakeBuilder) [./test/ > > test_gem_ext_rake_builder.rb:46]: > > <Gem::InstallError> exception expected but none was thrown. > > > > As I see RubyGems could not correctly define that Rake finished > > with error > > This is what RubyGems do > > unless $?.exitstatus.zero? then > > raise Gem::InstallError, "#{class_name} failed:\n\n# > > { results.join "\n"}" > > end > > > > But Rake finishes with return code == 0 on windows even if some > > error present. I dunno why, better to ask Rake developers. > > What does this script print? > > system 'ruby -e "raise"' > p $? > > I get: > > $ ruby -ve test.rb > ruby 1.8.5 (2006-12-04 patchlevel 2) [ i686-darwin8.8.2] > -e:1: unhandled exception > #<Process::Status: pid=28805,exited(1)> > $ > I get following output > -e:1: unhandled exception > #<Process::Status: pid=5428,exited(1)> > > But if I create file Rakefile with following content (as in test) > task :extension do abort 'fail' end > > and try to invoke it (as in RubyGems code) > > `rake.bat extension` > p $? > > I would get following output > > C:\work\opensource\ruby\rubygems\~my>rake-error-outstatus.rb > fail > #<Process::Status: pid=7788,exited(0)> > > So as you see `rake` returns us zero exitcode even if we have > failure during Rake execution. > > It is Windows. What do you have under *nix? $ ruby -e '`rake extension`; p $?' fail #<Process::Status: pid=29518,exited(1)> > > Anyway this is how I define that rake finished with error in > Cerberus. > > > > def successful? > > $?.exitstatus == 0 and not @output.include?("rake aborted!") > > end > > > > I dont think that it is very elegant (what if user would print this > > message from Rake code) but it works both on Windoze and *nix. > > > > Any comments on this subject?
-- anatol (http://feeds.feedburner.com/apomozov-eng)
Index: test/test_gem_ext_rake_builder.rb =================================================================== --- test/test_gem_ext_rake_builder.rb (revision 1160) +++ test/test_gem_ext_rake_builder.rb (working copy) @@ -54,12 +54,12 @@ rake failed: rake [EMAIL PROTECTED] [EMAIL PROTECTED] extension -fail (in #{realdir}) rake aborted! fail #{realdir}/rakefile:1:in `abort' (See full trace by running task with --trace) +fail EOF assert_equal expected, error.message Index: lib/rubygems/installer.rb =================================================================== --- lib/rubygems/installer.rb (revision 1160) +++ lib/rubygems/installer.rb (working copy) @@ -596,7 +596,7 @@ results << command results << `#{command} #{redirector}` - unless $?.exitstatus.zero? then + if not $?.exitstatus.zero? or results[1] =~ /^rake aborted!$/ then raise Gem::InstallError, "#{class_name} failed:\n\n#{results.join "\n"}" end end
_______________________________________________ Rubygems-developers mailing list Rubygems-developers@rubyforge.org http://rubyforge.org/mailman/listinfo/rubygems-developers