Permalink
Browse files

Fixing problem with execution of command type

  • Loading branch information...
1 parent 9cf49ec commit d1d2b21377663443a3ff89b181e930514dae82e9 Hermes Ojeda Ruiz committed Sep 18, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/nyan_cat_music_formatter.rb
@@ -46,13 +46,13 @@ def kill_music
private
def play_on_linux
- kernel.system("[ -e #{nyan_mp3} ] && type mpg321 &>/dev/null && mpg321 #{nyan_mp3} &>/dev/null &") if kernel.system("type mpg321")
- kernel.system("[ -e #{nyan_mp3} ] && type mpg123 &>/dev/null && mpg123 #{nyan_mp3} &>/dev/null &") if kernel.system("type mpg123")
+ kernel.system("[ -e #{nyan_mp3} ] && type mpg321 &>/dev/null && mpg321 #{nyan_mp3} &>/dev/null &") if kernel.system('which mpg321 && type mpg321')
+ kernel.system("[ -e #{nyan_mp3} ] && type mpg123 &>/dev/null && mpg123 #{nyan_mp3} &>/dev/null &") if kernel.system('which mpg123 && type mpg123')
end
def kill_music_on_linux
- system("killall -9 mpg321 &>/dev/null") if kernel.system("type mpg321")
- system("killall -9 mpg123 &>/dev/null") if kernel.system("type mpg123")
+ system("killall -9 mpg321 &>/dev/null") if kernel.system("which mpg321 && type mpg321")
+ system("killall -9 mpg123 &>/dev/null") if kernel.system("which mpg123 && type mpg123")
end
end

0 comments on commit d1d2b21

Please sign in to comment.