class Byebug::CommandProcessor

def self.protect(mname)

def self.protect(mname)
  alias_method "__#{mname}", mname
  module_eval %{
    def #{mname}(*args)
      @mutex.synchronize do
        return unless @interface
        __#{mname}(*args)
      end
    rescue IOError, Errno::EPIPE
      self.interface = nil
    rescue SignalException
      raise
    rescue Exception
      print "INTERNAL ERROR!!! #\{$!\}\n" rescue nil
      print $!.backtrace.map{|l| "\t#\{l\}"}.join("\n") rescue nil
    end
  }
end