5 VALUE
method_execve(VALUE self
, VALUE cmd
, VALUE env
);
8 mKernel
= rb_const_get(rb_cObject
, rb_intern("Kernel"));
9 rb_define_method(mKernel
, "execve", method_execve
, 2);
12 VALUE
method_execve(VALUE self
, VALUE r_cmd
, VALUE r_env
) {
13 char *shell
= (char *)dln_find_exe("sh", 0);
14 char *arg
[] = { "sh", "-c", StringValuePtr(r_cmd
), (char *)0 };
16 struct RArray
*env_array
;
17 env_array
= RARRAY(r_env
);
18 char *env
[env_array
->len
+ 1];
21 for(i
= 0; i
< env_array
->len
; i
++) {
22 env
[i
] = StringValuePtr(env_array
->ptr
[i
]);
25 env
[env_array
->len
] = (char *)0;
27 execve(shell
, arg
, env
);