mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
process.c: command_name encoding
* process.c (rb_exec_fillarg): share subsequence of argv_buf for command_name, and copy the encoding from the command string. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eaf301d2be
commit
28490dd1fd
2 changed files with 19 additions and 1 deletions
|
@ -2210,7 +2210,9 @@ rb_exec_fillarg(VALUE prog, int argc, VALUE *argv, VALUE env, VALUE opthash, VAL
|
|||
}
|
||||
}
|
||||
eargp->invoke.cmd.argv_buf = argv_buf;
|
||||
eargp->invoke.cmd.command_name = hide_obj(rb_str_new_cstr(RSTRING_PTR(argv_buf)));
|
||||
eargp->invoke.cmd.command_name =
|
||||
hide_obj(rb_str_subseq(argv_buf, 0, strlen(RSTRING_PTR(argv_buf))));
|
||||
rb_enc_copy(eargp->invoke.cmd.command_name, prog);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -181,5 +181,21 @@ class TestSystem < Test::Unit::TestCase
|
|||
assert_raise_with_message(RuntimeError, /\ACommand failed with exit /) do
|
||||
system("'#{ruby}' -e abort", exception: true)
|
||||
end
|
||||
|
||||
Dir.mktmpdir("ruby_script_tmp") do |tmpdir|
|
||||
name = "\u{30c6 30b9 30c8}"
|
||||
tmpfilename = "#{tmpdir}/#{name}.cmd"
|
||||
message = /#{name}\.cmd/
|
||||
e = assert_raise_with_message(Errno::ENOENT, message) do
|
||||
system(tmpfilename, exception: true)
|
||||
end
|
||||
open(tmpfilename, "w") {|f|
|
||||
f.puts "exit 127"
|
||||
f.chmod(0755)
|
||||
}
|
||||
e = assert_raise_with_message(RuntimeError, message) do
|
||||
system(tmpfilename, exception: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue