From 7b27fa31cef8e43522bfa4bca8adb74881de7590 Mon Sep 17 00:00:00 2001 From: Brent Theisen Date: Fri, 11 Apr 2014 16:49:58 -0500 Subject: [PATCH] Print message and exit rsync-auto immediately if there is nothing to watch. --- plugins/synced_folders/rsync/command/rsync_auto.rb | 7 +++++++ templates/locales/en.yml | 2 ++ 2 files changed, 9 insertions(+) diff --git a/plugins/synced_folders/rsync/command/rsync_auto.rb b/plugins/synced_folders/rsync/command/rsync_auto.rb index f6a939c6d..e495ce41e 100644 --- a/plugins/synced_folders/rsync/command/rsync_auto.rb +++ b/plugins/synced_folders/rsync/command/rsync_auto.rb @@ -70,6 +70,13 @@ module VagrantPlugins end end + # Exit immediately if there is nothing to watch + if paths.empty? + @logger.warn("No paths to listen for so exiting") + @env.ui.info(I18n.t("vagrant.rsync_auto_no_paths")) + return 1 + end + # Output to the user what paths we'll be watching paths.keys.sort.each do |path| paths[path].each do |path_opts| diff --git a/templates/locales/en.yml b/templates/locales/en.yml index d8727cd5e..a39901ea4 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -156,6 +156,8 @@ en: Running cleanup tasks for '%{name}' provisioner... rsync_auto_initial: |- Doing an initial rsync... + rsync_auto_no_paths: |- + No paths to watch rsync_auto_path: |- Watching: %{path} rsync_communicator_not_ready: |-