command/rsync-auto: add --poll flag [GH-4392]
This commit is contained in:
parent
de71e269fa
commit
a54f2dc539
|
@ -19,6 +19,7 @@ IMPROVEMENTS:
|
|||
- commands/plugin: Better error output is shown when plugin installation
|
||||
fails.
|
||||
- commands/reload: show post up messsage [GH-4168]
|
||||
- commands/rsync-auto: Add `--poll` flag. [GH-4392]
|
||||
- communicators/winrm: Show stdout/stderr if command fails. [GH-4094]
|
||||
- guests/nixos: Added better NFS support. [GH-3983]
|
||||
- providers/hyperv: Accept VHD disk format. [GH-4208]
|
||||
|
|
|
@ -28,9 +28,16 @@ module VagrantPlugins
|
|||
def execute
|
||||
@logger = Log4r::Logger.new("vagrant::commands::rsync-auto")
|
||||
|
||||
options = {}
|
||||
opts = OptionParser.new do |o|
|
||||
o.banner = "Usage: vagrant rsync-auto [vm-name]"
|
||||
o.separator ""
|
||||
o.separator "Options:"
|
||||
o.separator ""
|
||||
|
||||
o.on("--[no-]poll", "Force polling filesystem (slow)") do |poll|
|
||||
options[:poll] = poll
|
||||
end
|
||||
end
|
||||
|
||||
# Parse the options and return if we don't have any target.
|
||||
|
@ -106,7 +113,8 @@ module VagrantPlugins
|
|||
end
|
||||
@logger.info("Listening via: #{Listen::Adapter.select.inspect}")
|
||||
callback = method(:callback).to_proc.curry[paths]
|
||||
listener = Listen.to(*paths.keys, ignore: ignores, &callback)
|
||||
listopts = { ignore: ignores, force_polling: !!opts[:poll] }
|
||||
listener = Listen.to(*paths.keys, listopts, &callback)
|
||||
|
||||
# Create the callback that lets us know when we've been interrupted
|
||||
queue = Queue.new
|
||||
|
|
|
@ -15,6 +15,13 @@ not exit until an interrupt is received.
|
|||
The change detection is optimized to use platform-specific APIs to listen
|
||||
for filesystem changes, and does not simply poll the directory.
|
||||
|
||||
## Options
|
||||
|
||||
* `--[no-]poll` - Force Vagrant to watch for changes using filesystem
|
||||
polling instead of filesystem events. This is required for some filesystems
|
||||
that don't support events. Warning: enabling this will make `rsync-auto`
|
||||
_much_ slower. By default, polling is disabled.
|
||||
|
||||
## Machine State Changes
|
||||
|
||||
The `rsync-auto` command does not currently handle machine state changes
|
||||
|
|
Loading…
Reference in New Issue