Flush all log output and sleep a bit for NFS export warning [closes GH-119]

This commit is contained in:
Mitchell Hashimoto 2010-07-24 00:29:46 -07:00
parent 555b5af2a8
commit 14e7ff8d00
3 changed files with 17 additions and 0 deletions

View File

@ -23,7 +23,11 @@ module Vagrant
:ip => ip,
:folders => folders)
# The sleep ensures that the output is truly flushed before any `sudo`
# commands are issued.
env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
sleep 0.5
output.split("\n").each do |line|
# This should only ask for administrative permission once, even
# though its executed in multiple subshells.

View File

@ -25,6 +25,8 @@ module Vagrant
:folders => folders)
env.logger.info "Preparing to edit /etc/exports. Administrator priveleges will be required..."
sleep 0.5
output.split("\n").each do |line|
# This should only ask for administrative permission once, even
# though its executed in multiple subshells.

View File

@ -3,6 +3,17 @@ module Vagrant
# Subclass of the standard library logger which has no format on
# its own. The message sent to the logger is outputted as-is.
class PlainLogger < ::Logger
# This is the method which is called for all debug, info, error,
# etc. methods by the logger. This is overriden to verify that
# the output is always flushed.
#
# Logger by default syncs all log devices but this just verifies
# it is truly flushed.
def add(*args)
super
@logdev.dev.flush if @logdev
end
def format_message(level, time, progname, msg)
# We do no formatting, its up to the user
"#{msg}\n"