Class: Capybara::Lightpanda::Process
- Inherits:
-
Object
- Object
- Capybara::Lightpanda::Process
- Defined in:
- lib/capybara/lightpanda/process.rb
Constant Summary collapse
- READY_PATTERN =
/server running.*address\s*=\s*(\d+\.\d+\.\d+\.\d+:\d+)/m- ADDRESS_IN_USE_PATTERN =
/err=AddressInUse/- MINIMUM_NIGHTLY_BUILD =
Floor for the cookie/navigation/redirect/modal/keyboard/css/forms fixes the gem now relies on: PR #2255 (Network.clearBrowserCookies empty params + Network.getAllCookies), PR #2257 (window.location.pathname/.search assignment triggers navigation), PR #2265 (URL fragment inherited across fragment-less redirect), PR #2261 (LP.handleJavaScriptDialog pre-arm), PR #2283 (Referer on cross-page nav), PR #2292 (KeyboardEvent.keyCode/charCode), PR #2294 (UA stylesheet display:none for HEAD/SCRIPT/STYLE/NOSCRIPT/TEMPLATE/ TITLE/), PR #2308 (textarea LF→CRLF), PR #2312 (<input type=image> click submits form), PR #2315 (:disabled honors fieldset/ optgroup ancestors), PR #2322 (LP dialog defaultText fallback when promptText is null), PR #2324 (<label> click runs activation behavior on labeled control), PR #2286 (HTML constraint validation API: el.validity, validationMessage, checkValidity, reportValidity), PR #2342 (<summary> click toggles parent <details>.open). Build 6005 = main HEAD 0420802f (2026-05-04); ships in nightly published 2026-05-04 03:44 UTC for all four platforms.
Gem::Version.new("6005")
Instance Attribute Summary collapse
-
#nightly_build ⇒ Object
readonly
Returns the value of attribute nightly_build.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#ws_url ⇒ Object
readonly
Returns the value of attribute ws_url.
Instance Method Summary collapse
- #alive? ⇒ Boolean
-
#initialize(options) ⇒ Process
constructor
A new instance of Process.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ Process
Returns a new instance of Process.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/capybara/lightpanda/process.rb', line 32 def initialize() @options = @pid = nil @ws_url = nil @version = nil @nightly_build = nil @stdout_r = nil @stdout_w = nil @stderr_r = nil @stderr_w = nil end |
Instance Attribute Details
#nightly_build ⇒ Object (readonly)
Returns the value of attribute nightly_build.
30 31 32 |
# File 'lib/capybara/lightpanda/process.rb', line 30 def nightly_build @nightly_build end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
30 31 32 |
# File 'lib/capybara/lightpanda/process.rb', line 30 def pid @pid end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
30 31 32 |
# File 'lib/capybara/lightpanda/process.rb', line 30 def version @version end |
#ws_url ⇒ Object (readonly)
Returns the value of attribute ws_url.
30 31 32 |
# File 'lib/capybara/lightpanda/process.rb', line 30 def ws_url @ws_url end |
Instance Method Details
#alive? ⇒ Boolean
82 83 84 85 86 87 88 89 |
# File 'lib/capybara/lightpanda/process.rb', line 82 def alive? return false unless @pid ::Process.kill(0, @pid) true rescue Errno::ESRCH, Errno::EPERM false end |
#start ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/capybara/lightpanda/process.rb', line 44 def start binary_path = @options.browser_path || Binary.find_or_download raise BinaryNotFoundError, "Lightpanda binary not found" unless binary_path check_minimum_version(binary_path) attempt_start(binary_path) rescue ProcessTimeoutError => e raise unless e..include?("already in use") kill_process_on_port(@options.port) attempt_start(binary_path) end |
#stop ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/capybara/lightpanda/process.rb', line 58 def stop return unless @pid begin ::Process.kill("TERM", -@pid) # Kill process group rescue Errno::ESRCH, Errno::EPERM # Process group already dead, try direct begin ::Process.kill("TERM", @pid) rescue Errno::ESRCH # Process already dead end end begin ::Process.wait(@pid) rescue Errno::ECHILD # Already reaped end cleanup_pipes @pid = nil end |