Use symbol as a hash key for subprocess. Guarantees we always get a string back.
This commit is contained in:
parent
527b79853c
commit
3f3476f323
|
@ -69,7 +69,7 @@ module Vagrant
|
||||||
stderr_writer.close
|
stderr_writer.close
|
||||||
|
|
||||||
# Create a dictionary to store all the output we see.
|
# Create a dictionary to store all the output we see.
|
||||||
io_data = { stdout => "", stderr => "" }
|
io_data = { :stdout => "", :stderr => "" }
|
||||||
|
|
||||||
# Record the start time for timeout purposes
|
# Record the start time for timeout purposes
|
||||||
start_time = Time.now.to_i
|
start_time = Time.now.to_i
|
||||||
|
@ -94,7 +94,7 @@ module Vagrant
|
||||||
io_name = r == stdout ? :stdout : :stderr
|
io_name = r == stdout ? :stdout : :stderr
|
||||||
@logger.debug("#{io_name}: #{data}")
|
@logger.debug("#{io_name}: #{data}")
|
||||||
|
|
||||||
io_data[r] += data
|
io_data[io_name] += data
|
||||||
yield io_name, data if block_given?
|
yield io_name, data if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -133,15 +133,15 @@ module Vagrant
|
||||||
|
|
||||||
# Log it out and accumulate
|
# Log it out and accumulate
|
||||||
@logger.debug(extra_data)
|
@logger.debug(extra_data)
|
||||||
io_data[io] += extra_data
|
io_name = io == stdout ? :stdout : :stderr
|
||||||
|
io_data[io_name] += extra_data
|
||||||
|
|
||||||
# Yield to any listeners any remaining data
|
# Yield to any listeners any remaining data
|
||||||
io_name = io == stdout ? :stdout : :stderr
|
|
||||||
yield io_name, extra_data if block_given?
|
yield io_name, extra_data if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Return an exit status container
|
# Return an exit status container
|
||||||
return Result.new(process.exit_code, io_data[stdout], io_data[stderr])
|
return Result.new(process.exit_code, io_data[:stdout], io_data[:stderr])
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
Loading…
Reference in New Issue