Actions
Bug #15621
closedsystem({}, ...) breaks nonascii ENV["PATH"] on Windows
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x64-mingw32]
Description
Problem¶
It seems that system({}, ...)
breaks nonascii ENV["PATH"]
after execution.
system(...)
isn't affected. Only system(env, ...)
is affected.
OS: Windows 7
Ruby: https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.1-1/rubyinstaller-2.6.1-1-x64.exe
chcp: 現在のコード ページ: 932
Expected¶
system({}, ...)
doesn't break nonascii ENV["PATH"]
environment variable after execution.
Actual¶
Here is the sample code to reproduce this issue.
cat break-env-system.rb
# coding: cp932
ENV["PATH"] = [
"インストール",
ENV["PATH"],
].join(File::PATH_SEPARATOR)
env = {}
p ENV["PATH"]
system(env, "echo")
p ENV["PATH"]
It produces the following output:
"インストール;%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\CMake\\bin;C:\\GnuWin32\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\patch-2.5.9-7-bin\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Ruby26-x64\\bin"
ECHO は <ON> です。
"?C???X?g?[??;%SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\CMake\\bin;C:\\GnuWin32\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\patch-2.5.9-7-bin\\bin;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Ruby26-x64\\bin"
If system("echo")
is used instead of system({}, "echo")
, ENV["PATH"]
is not broken.
Files
Actions
Like0
Like0