summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-03 03:50:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-03 03:50:28 +0000
commit28490dd1fd481587450a25ba1cb259d6c1869e5b (patch)
treeaab17a6d6a15fc586e110a5afe1cb017a0cd8b92 /process.c
parenteaf301d2be3b437053dfdfe71c76fe0d2da6475f (diff)
downloadruby-28490dd1fd481587450a25ba1cb259d6c1869e5b.tar.gz
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
Diffstat (limited to 'process.c')
-rw-r--r--process.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/process.c b/process.c
index 7a4fa3066e..0195a0fe23 100644
--- a/process.c
+++ b/process.c
@@ -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