def readline(prompt)
if @negotiated && !@unbound
op = proc { Readline.readline(prompt, !prompt.nil?) }
callback = proc do |l|
if '!!' == l[0..1]
send_msg_bcast(l[2..-1])
elsif '!' == l[0]
send_msg(l[1..-1])
elsif '.' == l[0]
if !Client.const_defined?(:Keyboard)
Kernel.puts "\033[31minteractive shell commands are not supported without termios\033[0m"
readline(prompt)
else
send_shell_cmd(l[1..-1])
if Gem.loaded_specs["eventmachine"].version < Gem::Version.new("1.0.0.beta4")
Kernel.puts "\033[1minteractive shell commands are not well supported when running on EventMachine prior to 1.0.0.beta4\033[0m"
else
@keyboard = EM.open_keyboard(Keyboard, self)
end
end
elsif 'reset' == l.strip
Kernel.puts "\033[1m#{$0} #{ARGV.join(' ')}\033[0m"
exec("#{$0} #{ARGV.join(' ')}")
else
send_raw(l)
end
end
EM.defer(op, callback)
end
end