Skip to content

Commit

Permalink
Pass exit status of DRb run to invoking process
Browse files Browse the repository at this point in the history
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
Ilkka Laukkanen authored and justinko committed Mar 13, 2011
1 parent 0dea1af commit 00d842b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
16 changes: 5 additions & 11 deletions lib/rspec/core/drb_command_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lib/rspec/core/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00d842b

Please sign in to comment.