* process.c (check_exec_redirect1): extracted from
check_exec_redirect. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
92af9dddc8
commit
759c214a33
@ -1,3 +1,8 @@
|
||||
Sat Jun 23 18:44:13 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (check_exec_redirect1): extracted from
|
||||
check_exec_redirect.
|
||||
|
||||
Sat Jun 23 17:22:02 2012 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* process.c (save_env): don't use EXEC_OPTION_UNSETENV_OTHERS.
|
||||
|
41
process.c
41
process.c
@ -1430,6 +1430,28 @@ check_exec_redirect_fd(VALUE v, int iskey)
|
||||
return INT2FIX(fd);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
check_exec_redirect1(VALUE ary, VALUE key, VALUE param)
|
||||
{
|
||||
if (NIL_P(ary)) {
|
||||
ary = hide_obj(rb_ary_new());
|
||||
}
|
||||
if (!RB_TYPE_P(key, T_ARRAY)) {
|
||||
VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
|
||||
rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
|
||||
}
|
||||
else {
|
||||
int i, n=0;
|
||||
for (i = 0 ; i < RARRAY_LEN(key); i++) {
|
||||
VALUE v = RARRAY_PTR(key)[i];
|
||||
VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
|
||||
rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
|
||||
n++;
|
||||
}
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
static void
|
||||
check_exec_redirect(VALUE key, VALUE val, VALUE options)
|
||||
{
|
||||
@ -1515,23 +1537,8 @@ check_exec_redirect(VALUE key, VALUE val, VALUE options)
|
||||
}
|
||||
|
||||
ary = rb_ary_entry(options, index);
|
||||
if (NIL_P(ary)) {
|
||||
ary = hide_obj(rb_ary_new());
|
||||
rb_ary_store(options, index, ary);
|
||||
}
|
||||
if (!RB_TYPE_P(key, T_ARRAY)) {
|
||||
VALUE fd = check_exec_redirect_fd(key, !NIL_P(param));
|
||||
rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
|
||||
}
|
||||
else {
|
||||
int i, n=0;
|
||||
for (i = 0 ; i < RARRAY_LEN(key); i++) {
|
||||
VALUE v = RARRAY_PTR(key)[i];
|
||||
VALUE fd = check_exec_redirect_fd(v, !NIL_P(param));
|
||||
rb_ary_push(ary, hide_obj(rb_assoc_new(fd, param)));
|
||||
n++;
|
||||
}
|
||||
}
|
||||
ary = check_exec_redirect1(ary, key, param);
|
||||
rb_ary_store(options, index, ary);
|
||||
}
|
||||
|
||||
#if defined(HAVE_SETRLIMIT) && defined(NUM2RLIM)
|
||||
|
Loading…
x
Reference in New Issue
Block a user