win32: UTF-8 spawn

* io.c (spawnv, spawn): use UTF-8 spawn family.  [Bug #1771]
* process.c (proc_exec_sh, proc_spawn_cmd, proc_spawn_sh): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-06-30 01:59:21 +00:00
parent 8d2ce0fb1f
commit 637d668bca
4 changed files with 39 additions and 7 deletions

View file

@ -16,6 +16,9 @@ class TestProcess < Test::Unit::TestCase
end
def windows?
self.class.windows?
end
def self.windows?
return /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
end
@ -1608,6 +1611,28 @@ EOS
end
end
def test_spawn_nonascii
bug1771 = '[ruby-core:24309] [Bug #1771]'
with_tmpchdir do
[
"\u{7d05 7389}",
"zuf\u{00E4}llige_\u{017E}lu\u{0165}ou\u{010D}k\u{00FD}_\u{10D2 10D0 10DB 10D4 10DD 10E0 10D4 10D1}_\u{0440 0430 0437 043B 043E 0433 0430}_\u{548C 65B0 52A0 5761 4EE5 53CA 4E1C}",
# "c\u{1EE7}a", # work with a backslash, but not with a slash, for some reason.
].each do |name|
msg = "#{bug1771} #{name}"
exename = "./#{name}.exe"
FileUtils.cp(ENV["COMSPEC"], exename)
assert_equal(true, system("#{exename} /c exit"), msg)
system("#{exename} /c exit 12")
assert_equal(12, $?.exitstatus, msg)
_, status = Process.wait2(Process.spawn("#{exename} /c exit 42"))
assert_equal(42, status.exitstatus, msg)
assert_equal("ok\n", `#{exename} /c echo ok`, msg)
assert_equal("ok\n", IO.popen("#{exename} /c echo ok", &:read), msg)
assert_equal("ok\n", IO.popen(%W"#{exename} /c echo ok", &:read), msg)
end
end
end if windows?
end