Subprocess: Check if data is empty after the process exits as well

This commit is contained in:
Mitchell Hashimoto 2011-12-21 22:12:22 -08:00
parent 271c3827a1
commit 79460f6122
1 changed files with 5 additions and 0 deletions

View File

@ -105,10 +105,15 @@ module Vagrant
# amount of text between the time we last read data and when the
# process exited.
[stdout, stderr].each do |io|
# Read the extra data, ignoring if there isn't any
extra_data = read_io(io)
next if extra_data == ""
# Log it out and accumulate
@logger.debug(extra_data)
io_data[io] += extra_data
# Yield to any listeners any remaining data
io_name = io == stdout ? :stdout : :stderr
yield io_name, extra_data if block_given?
end