Skip to content
This repository was archived by the owner on Feb 1, 2024. It is now read-only.

Commit 2a70316

Browse files
committed
Fix killing ff
1 parent ada5b58 commit 2a70316

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

components/browser.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def terminate(self, timeout = 20):
145145
time.sleep(2)
146146
finally:
147147
pass
148+
else:
149+
self.process = None
148150

149151
try:
150152
if self.temp_user_data_dir is not None:
@@ -301,13 +303,17 @@ class Firefox(Browser):
301303
browsertime_binary = 'firefox'
302304
extra_processes = ['firefox', 'Firefox', 'plugin-container']
303305

304-
def terminate(self):
306+
def kill(self, force: bool):
305307
if is_win():
306-
subprocess.call(['taskkill', '/IM', 'firefox.exe'])
308+
subprocess.call(['taskkill', '/IM', 'firefox.exe'] + ['-9'] if force else [])
307309
if is_mac():
308-
subprocess.call(['killall', 'firefox'])
309-
time.sleep(2)
310+
subprocess.call(['killall', 'Firefox'] + ['-9'] if force else [])
311+
312+
def terminate(self):
313+
self.kill(False)
314+
time.sleep(2)
310315
super().terminate()
316+
self.kill(True)
311317

312318
def prepare_profile(self):
313319
cache_dir = None

components/script_measurement.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ def Run(
3232
browser.terminate()
3333
raise e
3434

35+
browser.terminate()
3536
return res

0 commit comments

Comments
 (0)