Class: Puppeteer::BrowserRunner::BrowserProcess

Inherits:
Object
  • Object
show all
Defined in:
lib/puppeteer/browser_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env, executable_path, args) ⇒ BrowserProcess

Returns a new instance of BrowserProcess.



23
24
25
26
27
# File 'lib/puppeteer/browser_runner.rb', line 23

def initialize(env, executable_path, args)
  stdin, @stdout, @stderr, @thread = Open3.popen3(env, executable_path, *args)
  stdin.close
  @pid = @thread.pid
end

Instance Attribute Details

#stderrObject (readonly)

Returns the value of attribute stderr.



40
41
42
# File 'lib/puppeteer/browser_runner.rb', line 40

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



40
41
42
# File 'lib/puppeteer/browser_runner.rb', line 40

def stdout
  @stdout
end

Instance Method Details

#disposeObject



35
36
37
38
# File 'lib/puppeteer/browser_runner.rb', line 35

def dispose
  [@stdout, @stderr].each { |io| io.close unless io.closed? }
  @thread.join
end

#killObject



29
30
31
32
33
# File 'lib/puppeteer/browser_runner.rb', line 29

def kill
  Process.kill(:KILL, @pid)
rescue Errno::ESRCH
  # already killed
end