Class: Puppeteer::BrowserRunner::BrowserProcess
- Inherits:
-
Object
- Object
- Puppeteer::BrowserRunner::BrowserProcess
- Defined in:
- lib/puppeteer/browser_runner.rb
Instance Attribute Summary collapse
-
#spawnargs ⇒ Object
readonly
Returns the value of attribute spawnargs.
-
#stderr ⇒ Object
readonly
Returns the value of attribute stderr.
-
#stdout ⇒ Object
readonly
Returns the value of attribute stdout.
Instance Method Summary collapse
- #dispose ⇒ Object
-
#initialize(env, executable_path, args) ⇒ BrowserProcess
constructor
A new instance of BrowserProcess.
- #kill ⇒ Object
Constructor Details
#initialize(env, executable_path, args) ⇒ BrowserProcess
Returns a new instance of BrowserProcess.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/puppeteer/browser_runner.rb', line 22 def initialize(env, executable_path, args) @spawnargs = if args && !args.empty? [executable_path] + args else [executable_path] end stdin, @stdout, @stderr, @thread = Open3.popen3(env, executable_path, *args) stdin.close @pid = @thread.pid rescue Errno::ENOENT => err raise LaunchError.new(err.) end |
Instance Attribute Details
#spawnargs ⇒ Object (readonly)
Returns the value of attribute spawnargs.
48 49 50 |
# File 'lib/puppeteer/browser_runner.rb', line 48 def spawnargs @spawnargs end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
48 49 50 |
# File 'lib/puppeteer/browser_runner.rb', line 48 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
48 49 50 |
# File 'lib/puppeteer/browser_runner.rb', line 48 def stdout @stdout end |
Instance Method Details
#dispose ⇒ Object
43 44 45 46 |
# File 'lib/puppeteer/browser_runner.rb', line 43 def dispose [@stdout, @stderr].each { |io| io.close unless io.closed? } @thread.join end |
#kill ⇒ Object
37 38 39 40 41 |
# File 'lib/puppeteer/browser_runner.rb', line 37 def kill Process.kill(:KILL, @pid) rescue Errno::ESRCH # already killed end |