Class: Cucumber::Cli::DRbClient

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/cli/drb_client.rb

Overview

Runs features on a DRB server, originally created with Spork compatibility in mind.

Constant Summary collapse

DEFAULT_PORT =
8990

Class Method Summary collapse

Class Method Details

.run(args, error_stream, out_stream, port = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cucumber/cli/drb_client.rb', line 14

def run(args, error_stream, out_stream, port = nil)
  port ||= ENV["CUCUMBER_DRB"] || DEFAULT_PORT

  setup_support_for_io_streams_over_drb

  feature_server = DRbObject.new_with_uri("druby://127.0.0.1:#{port}")
  cloned_args = [] # I have no idea why this is needed, but if the regular args are sent then DRb magically transforms it into a DRb object - not an array
  args.each { |arg| cloned_args << arg }
  feature_server.run(cloned_args, error_stream, out_stream)
rescue DRb::DRbConnError
  raise DRbClientError, "No DRb server is running."
end