File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
py/selenium/webdriver/common Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -125,12 +125,13 @@ def send_remote_shutdown_command(self):
125
125
url_request .urlopen ("%s/shutdown" % self .service_url )
126
126
except URLError :
127
127
return
128
- count = 0
129
- while self . is_connectable () :
130
- if count == 30 :
128
+
129
+ for _ in 30 :
130
+ if self . is_connectable () :
131
131
break
132
- count += 1
133
- time .sleep (1 )
132
+ else :
133
+ time .sleep (1 )
134
+
134
135
135
136
def stop (self ):
136
137
"""
@@ -160,14 +161,17 @@ def stop(self):
160
161
except AttributeError :
161
162
pass
162
163
self .process .terminate ()
163
- self .process .kill ()
164
164
self .process .wait ()
165
+ self .process .kill ()
165
166
self .process = None
166
167
except OSError :
167
- # kill may not be available under windows environment
168
168
pass
169
169
170
170
def __del__ (self ):
171
- # subprocess.Popen doesn't send signal on __del__;
172
- # we have to try to stop the launched process.
173
- self .stop ()
171
+ # `subprocess.Popen` doesn't send signal on `__del__`;
172
+ # so we attemt to close the launched process when `__del__`
173
+ # is triggered.
174
+ try :
175
+ self .stop ()
176
+ except Exception :
177
+ pass
You can’t perform that action at this time.
0 commit comments