Class: Hokaido::Broadcast::Command

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/hokaido/broadcast.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, host, port) ⇒ Command



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/hokaido/broadcast.rb', line 65

def initialize(command, host, port)
  ptyout, ptyin, pid = PTY.getpty(command)
  connection         = Connection.new_link(host, port)

  # FIXME: adjust on SIGWINCH
  adjust_screen_size ptyin

  OutputHandler.new_link ptyout, connection
  InputHandler.new_link ptyin

  async.wait_for_exit pid
end

Instance Method Details

#wait_for_exit(pid) ⇒ Object



78
79
80
81
82
# File 'lib/hokaido/broadcast.rb', line 78

def wait_for_exit(pid)
  Process.waitpid pid

  terminate
end