Preserve encoding in error message for invalid env exec option

This commit is contained in:
Nobuyoshi Nakada 2020-04-16 20:40:19 +09:00
parent 33aaa2aa15
commit f57e2d7296
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
2 changed files with 4 additions and 1 deletions

View File

@ -2325,7 +2325,7 @@ check_exec_env_i(st_data_t st_key, st_data_t st_val, st_data_t arg)
k = StringValueCStr(key);
if (strchr(k, '='))
rb_raise(rb_eArgError, "environment name contains a equal : %s", k);
rb_raise(rb_eArgError, "environment name contains a equal : %"PRIsVALUE, key);
if (!NIL_P(val))
StringValueCStr(val);

View File

@ -342,6 +342,9 @@ class TestProcess < Test::Unit::TestCase
assert_raise_with_message(ArgumentError, /fo=fo/) {
system({"fo=fo"=>"ha"}, *ENVCOMMAND)
}
assert_raise_with_message(ArgumentError, /\u{30c0}=\u{30e1}/) {
system({"\u{30c0}=\u{30e1}"=>"ha"}, *ENVCOMMAND)
}
end
def test_execopt_env_path