diff options
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/ircbot.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index 9cbe7dcb..baf52005 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -704,6 +704,8 @@ class Bot :split_at => Regexp.new(@config['send.split_at']), :purge_split => @config['send.purge_split'], :truncate_text => @config['send.truncate_text'].dup + + trap_sigs end def setup_plugins_path @@ -773,8 +775,8 @@ class Bot end end - # connect the bot to IRC - def connect + # trap signals + def trap_sigs begin trap("SIGINT") { got_sig("SIGINT") } trap("SIGTERM") { got_sig("SIGTERM") } @@ -784,6 +786,10 @@ class Bot rescue Exception => e debug "failed to trap signals: #{e.pretty_inspect}" end + end + + # connect the bot to IRC + def connect begin quit if $interrupted > 0 @socket.connect |