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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/puppeteer/browser_runner.rb', line 26 def initialize(env, executable_path, args) @spawnargs = if args && !args.empty? [executable_path] + args else [executable_path] end popen3_args = args || [] popen3_args << { pgroup: true } unless Puppeteer.env.windows? stdin, @stdout, @stderr, @thread = Open3.popen3(env, executable_path, *popen3_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.
54 55 56 |
# File 'lib/puppeteer/browser_runner.rb', line 54 def spawnargs @spawnargs end |
#stderr ⇒ Object (readonly)
Returns the value of attribute stderr.
54 55 56 |
# File 'lib/puppeteer/browser_runner.rb', line 54 def stderr @stderr end |
#stdout ⇒ Object (readonly)
Returns the value of attribute stdout.
54 55 56 |
# File 'lib/puppeteer/browser_runner.rb', line 54 def stdout @stdout end |
Instance Method Details
#dispose ⇒ Object
49 50 51 52 |
# File 'lib/puppeteer/browser_runner.rb', line 49 def dispose [@stdout, @stderr].each { |io| io.close unless io.closed? } @thread.join end |
#kill ⇒ Object
43 44 45 46 47 |
# File 'lib/puppeteer/browser_runner.rb', line 43 def kill Process.kill(:KILL, @pid) rescue Errno::ESRCH # already killed end |