fix subprocess external encode issue. https://github.com/mitchellh/vagrant/issues/3706
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:
parent
e308250689
commit
7da9648089
|
@ -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)
|
||||||
|
|
|
@ -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?
|
||||||
|
|
Loading…
Reference in New Issue