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