in io.rb
 subprocess resuts convert external encoding to utf-8

in subprocess.rb
 command line argument convert utf-8 to  external encoding
This commit is contained in:
Takekazu Omi 2014-05-08 17:59:45 +09:00
parent e308250689
commit 7da9648089
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?