Skip to content

Commit 7143ecc

Browse files
committed
rb: Add private Service#process_running? and Service#process_exited?
1 parent 82f6020 commit 7143ecc

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

rb/lib/selenium/webdriver/common/service.rb

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def initialize(executable_path, port, *extra_args)
4747
end
4848

4949
def start
50-
if @process && @process.alive?
50+
if process_running?
5151
raise "already started: #{uri.inspect} #{@executable_path.inspect}"
5252
end
5353

@@ -61,8 +61,7 @@ def start
6161
end
6262

6363
def stop
64-
return if @process.nil? || @process.exited?
65-
64+
return if process_exited?
6665
stop_server
6766
ensure
6867
stop_process
@@ -101,6 +100,14 @@ def stop_process
101100
@process.stop STOP_TIMEOUT
102101
end
103102

103+
def process_running?
104+
@process && @process.alive?
105+
end
106+
107+
def process_exited?
108+
@process.nil? || @process.exited?
109+
end
110+
104111
def connect_until_stable
105112
socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
106113
return if socket_poller.connected?

rb/lib/selenium/webdriver/edge/bridge.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def initialize(opts = {})
3131
if opts.has_key?(:url)
3232
url = opts.delete(:url)
3333
else
34-
@service = Service.default_service(*extract_service_args(opts))
34+
@service = Service.new(Edge.driver_path, Service::DEFAULT_PORT, *extract_service_args(opts))
3535

3636
if @service.instance_variable_get("@host") == "127.0.0.1"
3737
@service.instance_variable_set("@host", 'localhost')

0 commit comments

Comments
 (0)