def trap_signals
      shutdown = proc do |signal|
        STDERR.puts "\nReceived #{signal}, shutting down..."
        stop
        join
        exit 1
      end
      trap('INT')  { shutdown.call 'SIGINT'  }
      trap('TERM') { shutdown.call 'SIGTERM' }
    end
def trap_signals
      shutdown = proc do |signal|
        STDERR.puts "\nReceived #{signal}, shutting down..."
        stop
        join
        exit 1
      end
      trap('INT')  { shutdown.call 'SIGINT'  }
      trap('TERM') { shutdown.call 'SIGTERM' }
    end
Sets traps for SIGINT and SIGTERM so Codebot can shut down gracefully.