Class: Bcome::Ssh::Tunnel::LocalPortForward

Inherits:
Object
  • Object
show all
Defined in:
lib/objects/ssh/tunnel/local_port_forward.rb

Instance Method Summary collapse

Constructor Details

#initialize(tunnel_command) ⇒ LocalPortForward

Returns a new instance of LocalPortForward.



4
5
6
7
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 4

def initialize(tunnel_command)
  @tunnel_command = tunnel_command
  @process_pid = nil
end

Instance Method Details

#close!Object



14
15
16
17
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 14

def close!
  puts "Closing tunnel with process pid ##{@process_pid}: #{@tunnel_command}".informational
  ::Process.kill("HUP", @process_pid)
end

#open!Object



9
10
11
12
# File 'lib/objects/ssh/tunnel/local_port_forward.rb', line 9

def open!
  puts "Opening tunnel: #{@tunnel_command}".informational
  @process_pid = spawn(@tunnel_command)
end