Fix issue where we may not get the full output in a subprocess
This commit is contained in:
parent
d5981978a1
commit
8eb1770b9d
|
@ -65,9 +65,23 @@ module Vagrant
|
||||||
|
|
||||||
# Check the readers to see if they're ready
|
# Check the readers to see if they're ready
|
||||||
if !readers.empty?
|
if !readers.empty?
|
||||||
begin
|
|
||||||
readers.each do |r|
|
readers.each do |r|
|
||||||
data = r.read_nonblock(1024)
|
data = ""
|
||||||
|
while true
|
||||||
|
begin
|
||||||
|
data << r.read_nonblock(1024)
|
||||||
|
rescue IO::WaitReadable
|
||||||
|
# This just means the IO wasn't actually ready and we
|
||||||
|
# should wait some more. No problem! Just pass on through...
|
||||||
|
rescue EOFError
|
||||||
|
# Process exited, most likely. We're done here.
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# We don't need to do anything if the data is empty
|
||||||
|
next if data.empty?
|
||||||
|
|
||||||
io_name = r == stdout ? :stdout : :stderr
|
io_name = r == stdout ? :stdout : :stderr
|
||||||
@logger.debug(data)
|
@logger.debug(data)
|
||||||
|
|
||||||
|
@ -80,13 +94,6 @@ module Vagrant
|
||||||
io_data[r] += data
|
io_data[r] += data
|
||||||
yield io_name, data if block_given?
|
yield io_name, data if block_given?
|
||||||
end
|
end
|
||||||
rescue IO::WaitReadable
|
|
||||||
# This just means the IO wasn't actually ready and we
|
|
||||||
# should wait some more. No problem! Just pass on through...
|
|
||||||
rescue EOFError
|
|
||||||
# Process exited, most likely. We're done here.
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Break out if the process exited. We have to do this before
|
# Break out if the process exited. We have to do this before
|
||||||
|
|
Loading…
Reference in New Issue