Merge pull request #3707 from takekazuomi/fix/master/encodeissue

fix subprocess external encode issue.
This commit is contained in:
Mitchell Hashimoto 2014-10-23 23:18:19 -07:00
commit 370ca050db
2 changed files with 2 additions and 1 deletions

View File

@ -29,7 +29,7 @@ module Vagrant
break if !results || results[0].empty? break if !results || results[0].empty?
# Read! # Read!
data << io.readpartial(READ_CHUNK_SIZE) data << io.readpartial(READ_CHUNK_SIZE).encode("UTF-8", Encoding.default_external)
else else
# Do a simple non-blocking read on the IO object # Do a simple non-blocking read on the IO object
data << io.read_nonblock(READ_CHUNK_SIZE) data << io.read_nonblock(READ_CHUNK_SIZE)

View File

@ -25,6 +25,7 @@ module Vagrant
def initialize(*command) def initialize(*command)
@options = command.last.is_a?(Hash) ? command.pop : {} @options = command.last.is_a?(Hash) ? command.pop : {}
@command = command.dup @command = command.dup
@command.each { |s| s.encode!(Encoding.default_external) }
@command[0] = Which.which(@command[0]) if !File.file?(@command[0]) @command[0] = Which.which(@command[0]) if !File.file?(@command[0])
if !@command[0] if !@command[0]
raise Errors::CommandUnavailableWindows, file: command[0] if Platform.windows? raise Errors::CommandUnavailableWindows, file: command[0] if Platform.windows?