From e4f33c1ea92b56b09c6e58514c73b9a65bf09922 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 10 Aug 2008 14:12:08 +0200 Subject: irclog core module: skip, don't die when unable to open logfile --- lib/rbot/core/irclog.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'lib/rbot/core/irclog.rb') diff --git a/lib/rbot/core/irclog.rb b/lib/rbot/core/irclog.rb index 61fdc561..706a5a7a 100644 --- a/lib/rbot/core/irclog.rb +++ b/lib/rbot/core/irclog.rb @@ -272,10 +272,15 @@ class IrcLogModule < CoreBotModule end end fp = logfilepath(where_str, now) - FileUtils.mkdir_p File.dirname(fp) - f = File.new(fp, "a") - f.sync = true - f.puts "[#{stamp}] @ Log started by #{@bot.myself.nick}" + begin + FileUtils.mkdir_p File.dirname(fp) + f = File.new(fp, "a") + f.sync = true + f.puts "[#{stamp}] @ Log started by #{@bot.myself.nick}" + rescue Exception => e + error e + next + end @logs[where_str] = [now, f] end @logs[where_str][1].puts "[#{stamp}] #{message}" -- cgit v1.2.3