]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
figlet plugin: check paths and fonts using Utils.safe_exec
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 30 Jun 2008 14:08:47 +0000 (16:08 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 30 Jun 2008 14:08:47 +0000 (16:08 +0200)
data/rbot/plugins/figlet.rb

index 1b0c9fc0fc73caef85bd09f46e11acf1c49c62e6..64be496c683ecc17de52cc7b2e0ec3f05cf1f283 100644 (file)
@@ -58,10 +58,10 @@ class FigletPlugin < Plugin
 
   def test_figlet
     #check that figlet is present
-    @has[:figlet] = File.exist?(figlet_path)
+    @has[:figlet] = !!(Utils.safe_exec("#{figlet_path} -v") ; $?)
 
     # check that figlet actually has the font installed
-    @has[:figlet_font] = !!system("#{figlet_path} -f #{figlet_font} test test test")
+    @has[:figlet_font] = !!(Utils.safe_exec("#{figlet_path} -f #{figlet_font} test test test") ; $?)
 
     # set the commandline params
     @params[:figlet] = ['-k', '-w', MAX_WIDTH.to_s, '-C', 'utf8']
@@ -72,10 +72,10 @@ class FigletPlugin < Plugin
 
   def test_toilet
     #check that toilet is present
-    @has[:toilet] = File.exist?(toilet_path)
+    @has[:toilet] = !!(Utils.safe_exec("#{toilet_path} -v") ; $?)
 
     # check that toilet actually has the font installed
-    @has[:toilet_font] = !!system("#{toilet_path} -f #{toilet_font} test test test")
+    @has[:toilet_font] = !!(Utils.safe_exec("#{toilet_path} -f #{toilet_font} test test test") ; $?)
 
     # set the commandline params
     @params[:toilet] = ['-k', '-w', MAX_WIDTH.to_s, '-E', 'utf8', '--irc']