diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-04-11 12:41:45 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-04-11 13:12:05 +0200 |
commit | 9b25da35fe840d5a3cd1441729d59551097b1c1c (patch) | |
tree | c4b9f7c5cda383e4a52fe79e9ab2ba47d7e6627a | |
parent | 22d753aed9b358aae47a68edfa035dcf73580f52 (diff) |
figlet: use Utils.try_exec instead of !!$?
The !!$? method fails because !!$? is true unless $? is nil, whereas we
want to test for a successful exit.
-rw-r--r-- | data/rbot/plugins/figlet.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/data/rbot/plugins/figlet.rb b/data/rbot/plugins/figlet.rb index 0eebc813..8cbdbfd2 100644 --- a/data/rbot/plugins/figlet.rb +++ b/data/rbot/plugins/figlet.rb @@ -58,10 +58,10 @@ class FigletPlugin < Plugin def test_figlet #check that figlet is present - @has[:figlet] = !!(Utils.safe_exec("#{figlet_path} -v") ; $?) + @has[:figlet] = Utils.try_exec("#{figlet_path} -v") # check that figlet actually has the font installed - @has[:figlet_font] = !!(Utils.safe_exec("#{figlet_path} -f #{figlet_font} test test test") ; $?) + @has[:figlet_font] = Utils.try_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] = !!(Utils.safe_exec("#{toilet_path} -v") ; $?) + @has[:toilet] = Utils.try_exec("#{toilet_path} -v") # check that toilet actually has the font installed - @has[:toilet_font] = !!(Utils.safe_exec("#{toilet_path} -f #{toilet_font} test test test") ; $?) + @has[:toilet_font] = Utils.try_exec("#{toilet_path} -f #{toilet_font} test test test") # set the commandline params @params[:toilet] = ['-k', '-w', MAX_WIDTH.to_s, '-E', 'utf8', '--irc'] |