Skip to content

Commit

Permalink
catch firefox timeout when shutting down in headless environment
Browse files Browse the repository at this point in the history
  • Loading branch information
Finn von Friesland committed Sep 17, 2015
1 parent 15845eb commit 1c7f2aa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/controller/browser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,15 @@ def record(version)
end

def end
@browser.close
begin #Timeout::Error
Timeout::timeout(10) { @browser.close }
rescue Timeout::Error
browser_pid = @browser.driver.instance_variable_get(:@bridge).instance_variable_get(:@service).instance_variable_get(:@process).pid
::Process.kill('KILL', browser_pid)
sleep 1
end
@headless.destroy if @headless
sleep 5 # to prevent xvfb to freeze
end

private
Expand Down

0 comments on commit 1c7f2aa

Please sign in to comment.