Skip to content

Cannot call exit from within .on() blocks #395

@postmodern

Description

@postmodern

When I call exit from within an browser.on(...) { ... } block, it generates a weird logging error message instead of exiting. I suspect somewhere in Ferrum it is trying to rescue SystemExit as an error.

Example Code

require 'ferrum'

browser = Ferrum::Browser.new
browser.network.intercept
browser.on(:request) do
  exit
end

browser.go_to('https://example.com')
sleep

Expected Result

Exits the script

Actual Result

2023-08-28 04:52:02.989] ERROR -- exit: nil

Version Info

  • ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
  • ferrum (0.13)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions