From c566465bdcdafdaad7f25e37456aaa4a73d691fc Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Fri, 6 Dec 2013 18:12:39 -0300 Subject: [PATCH] Fix testing if initctl exists If /sbin/initctl was not found, the command (`false && ...`) returned non-zero exit code leading to Vagrant throwing an exception. --- plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index 3280c8b29..9459a9842 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -71,8 +71,10 @@ module VagrantPlugins machine.communicate.sudo(chown_commands[1]) if exit_status != 0 # Emit an upstart event if we can - machine.communicate.sudo("[ -x /sbin/initctl ] && " + - "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{guestpath}") + if machine.communicate.test("test -x /sbin/initctl") + machine.communicate.sudo( + "/sbin/initctl emit --no-wait vagrant-mounted MOUNTPOINT=#{guestpath}") + end end end end