From 00d842be8ef6902dfb1bc44a6227a5a9230f28a9 Mon Sep 17 00:00:00 2001 From: Ilkka Laukkanen Date: Wed, 9 Mar 2011 10:17:44 +0200 Subject: [PATCH] Pass exit status of DRb run to invoking process This change causes rspec to exit with a non-zero exit status when specs fail, even when running with DRb. Failover to local run is done by not catching DRb::DRbConnError exceptions in RSpec::Core::DRbCommandLine, instead letting them come up to Runner.run. --- lib/rspec/core/drb_command_line.rb | 16 +++++----------- lib/rspec/core/runner.rb | 7 ++++++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/rspec/core/drb_command_line.rb b/lib/rspec/core/drb_command_line.rb index 9e35b9307a..9dd2ca2890 100644 --- a/lib/rspec/core/drb_command_line.rb +++ b/lib/rspec/core/drb_command_line.rb @@ -11,18 +11,12 @@ def drb_port def run(err, out) begin - begin - DRb.start_service("druby://localhost:0") - rescue SocketError, Errno::EADDRNOTAVAIL - DRb.start_service("druby://:0") - end - spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}") - spec_server.run(@options.drb_argv, err, out) - true - rescue DRb::DRbConnError - err.puts "No DRb server is running. Running in local process instead ..." - false + DRb.start_service("druby://localhost:0") + rescue SocketError, Errno::EADDRNOTAVAIL + DRb.start_service("druby://:0") end + spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}") + spec_server.run(@options.drb_argv, err, out) end end end diff --git a/lib/rspec/core/runner.rb b/lib/rspec/core/runner.rb index 860d2d6727..5168283168 100644 --- a/lib/rspec/core/runner.rb +++ b/lib/rspec/core/runner.rb @@ -42,7 +42,12 @@ def self.run(args, err, out) options.parse_options if options.options[:drb] - run_over_drb(options, err, out) || run_in_process(options, err, out) + begin + run_over_drb(options, err, out) + rescue DRb::DRbConnError + err.puts "No DRb server is running. Running in local process instead ..." + run_in_process(options, err, out) + end else run_in_process(options, err, out) end