Skip to content
Browse files

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.
  • Loading branch information...
1 parent 0dea1af commit 00d842be8ef6902dfb1bc44a6227a5a9230f28a9 @ilkka ilkka committed with justinko Mar 9, 2011
Showing with 11 additions and 12 deletions.
  1. +5 −11 lib/rspec/core/drb_command_line.rb
  2. +6 −1 lib/rspec/core/runner.rb
View
16 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
View
7 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

0 comments on commit 00d842b

Please sign in to comment.
Something went wrong with that request. Please try again.