Skip to content

Commit 2ff2ab2

Browse files
committed
python: Closing driver server i/o channels when driver server stopped. Fixes issue 8498 on googlecode
1 parent 32e764d commit 2ff2ab2

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

py/selenium/webdriver/chrome/service.py

+2
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ def stop(self):
108108
#Tell the Server to properly die in case
109109
try:
110110
if self.process:
111+
self.process.stdout.close()
112+
self.process.stderr.close()
111113
self.process.kill()
112114
self.process.wait()
113115
except OSError:

py/selenium/webdriver/ie/service.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Service(object):
2828
def __init__(self, executable_path, port=0, host=None, log_level=None, log_file=None):
2929
"""
3030
Creates a new instance of the Service
31-
31+
3232
:Args:
3333
- executable_path : Path to the IEDriver
3434
- port : Port the service is running on
@@ -48,8 +48,8 @@ def __init__(self, executable_path, port=0, host=None, log_level=None, log_file=
4848

4949
def start(self):
5050
"""
51-
Starts the IEDriver Service.
52-
51+
Starts the IEDriver Service.
52+
5353
:Exceptions:
5454
- WebDriverException : Raised either when it can't start the service
5555
or when it can't connect to the service
@@ -77,9 +77,9 @@ def start(self):
7777
time.sleep(1)
7878
if count == 30:
7979
raise WebDriverException("Can not connect to the IEDriver")
80-
80+
8181
def stop(self):
82-
"""
82+
"""
8383
Tells the IEDriver to stop and cleans up the process
8484
"""
8585
#If its dead dont worry
@@ -96,13 +96,15 @@ def stop(self):
9696
count = 0
9797
while utils.is_connectable(self.port):
9898
if count == 30:
99-
break
99+
break
100100
count += 1
101101
time.sleep(1)
102-
102+
103103
#Tell the Server to properly die in case
104104
try:
105105
if self.process:
106+
self.process.stdout.close()
107+
self.process.stderr.close()
106108
self.process.kill()
107109
self.process.wait()
108110
except WindowsError:

py/selenium/webdriver/phantomjs/service.py

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def stop(self):
101101
#Tell the Server to properly die in case
102102
try:
103103
if self.process:
104+
self.process.stdin.close()
104105
self.process.send_signal(signal.SIGTERM)
105106
self.process.wait()
106107
except OSError:

0 commit comments

Comments
 (0)