Module: Blade::SauceLabsPlugin::Tunnel
- Extended by:
- Tunnel, Forwardable
- Included in:
- Tunnel
- Defined in:
- lib/blade/sauce_labs_plugin/tunnel.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
Instance Method Summary collapse
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
10 11 12 |
# File 'lib/blade/sauce_labs_plugin/tunnel.rb', line 10 def identifier @identifier end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/blade/sauce_labs_plugin/tunnel.rb', line 12 def start return if @process @identifier = SecureRandom.hex(10) @process = create_child_process started_at = Time.now timer = EM::PeriodicTimer.new(1) do if ready_file_exists? timer.cancel yield elsif !debug? elapsed = Time.now - started_at if elapsed > tunnel_timeout timer.cancel STDERR.puts "Failed to establish tunnel connection after #{elapsed}s:" STDERR.puts tunnel_io.tap(&:rewind).read exit(1) end end end end |
#stop ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/blade/sauce_labs_plugin/tunnel.rb', line 35 def stop return unless @process begin tunnel_io.unlink @process.stop(15) @process = nil rescue => error debug "Error stopping tunnel: #{error}" end end |