lib/vagrant-notify/action/install_command.rb in vagrant-notify-0.5.6 vs lib/vagrant-notify/action/install_command.rb in vagrant-notify-0.6.0

- old
+ new

@@ -30,19 +30,24 @@ end def install_command_on_guest(env, command_path) source = env[:tmp_path].join 'vagrant-notify-send' env[:machine].communicate.upload(source.to_s, '/tmp/notify-send') - env[:machine].communicate.sudo('mv /usr/bin/{notify-send,notify-send.bkp}; exit 0') - env[:machine].communicate.sudo('mv /tmp/notify-send /usr/bin/notify-send && chmod +x /usr/bin/notify-send') - if RUBY_PLATFORM =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ - env[:machine].communicate.sudo("sed 's/\r\$//' -i /usr/bin/notify-send") # dos2unix + + begin + env[:machine].communicate.sudo('mv /usr/bin/{notify-send,notify-send.bkp}; exit 0') + env[:machine].communicate.sudo('mv /tmp/notify-send /usr/bin/notify-send && chmod +x /usr/bin/notify-send') + if RUBY_PLATFORM =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/ + env[:machine].communicate.sudo("sed 's/\r\$//' -i /usr/bin/notify-send") # dos2unix + end + rescue => msg + env[:machine].ui.warn("vagrant-notify: failed to install /usr/bin/notify-send onto #{env[:machine].name}.\n#{msg}") end end def check_if_ruby_on_guest(env) ruby_check = '' - env[:machine].communicate.sudo("which ruby || true") {|type, data| ruby_check = data } + env[:machine].communicate.sudo("which ruby 2>/dev/null || true") {|type, data| ruby_check = data } if ruby_check.empty? env[:machine].ui.warn("Ruby is not installed on '#{env[:machine].name}' guest VM! vagrant-notify will not work until a version of Ruby is installed.") end end end