class Hokaido::Broadcast::Command

Public Class Methods

new(command, host, port) click to toggle source
# 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

Public Instance Methods

wait_for_exit(pid) click to toggle source
# File lib/hokaido/broadcast.rb, line 78
def wait_for_exit(pid)
  Process.waitpid pid

  terminate
end

Private Instance Methods

adjust_screen_size(ptyin) click to toggle source
# File lib/hokaido/broadcast.rb, line 86
def adjust_screen_size(ptyin)
  TermInfo.tiocswinsz ptyin, *TermInfo.screen_size
end