Module: Mxup::Restarter

Defined in:
lib/mxup/watcher.rb

Overview

Shared "restart this window in-place" helper. Used by Runner#restart_existing and by the Watcher daemon. Sends two Ctrl-Cs and re-sources the launcher.

Class Method Summary collapse

Class Method Details

.restart(session, target, command_keys, interrupt_delay: nil) ⇒ Object



159
160
161
162
163
164
165
166
# File 'lib/mxup/watcher.rb', line 159

def restart(session, target, command_keys, interrupt_delay: nil)
  delay = interrupt_delay || (defined?(Runner) ? Runner.interrupt_delay : 1.0)
  Tmux.send_interrupt(session, target)
  sleep delay
  Tmux.send_interrupt(session, target)
  sleep delay
  Tmux.send_keys(session, target, command_keys)
end