lib/vagrant/ui.rb in vagrant-unbundled-2.2.6.2 vs lib/vagrant/ui.rb in vagrant-unbundled-2.2.7.0
- old
+ new
@@ -327,13 +327,18 @@
target = @prefix
target = opts[:target] if opts.key?(:target)
target = "#{target}:" if target != ""
- # Get the lines. The first default is because if the message
- # is an empty string, then we want to still use the empty string.
lines = [message]
- lines = message.split("\n") if message != ""
+ if message != ""
+ lines = [].tap do |l|
+ message.scan(/(.*?)(\n|$)/).each do |m|
+ l << m.first if m.first != "" || (m.first == "" && m.last == "\n")
+ end
+ end
+ lines << "" if message.end_with?("\n")
+ end
# Otherwise, make sure to prefix every line properly
lines.map do |line|
"#{prefix}#{target} #{line}"
end.join("\n")