process.c: try conversion at redirection

* io.c (rb_io_check_io): make public.
* process.c (check_exec_redirect): try conversion to IO on redirect
  parameters.  [ruby-core:44181] [Bug #6269]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36551 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-07-27 09:25:54 +00:00
parent a8aa1e2127
commit c05e6a8cda
5 changed files with 27 additions and 2 deletions

View file

@ -1456,6 +1456,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
{
VALUE param;
VALUE path, flags, perm;
VALUE tmp;
ID id;
switch (TYPE(val)) {
@ -1484,6 +1485,7 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
break;
case T_FILE:
io:
val = check_exec_redirect_fd(val, 0);
/* fall through */
case T_FIXNUM:
@ -1531,6 +1533,9 @@ check_exec_redirect(VALUE key, VALUE val, struct rb_execarg *eargp)
break;
default:
tmp = val;
val = rb_io_check_io(tmp);
if (!NIL_P(val)) goto io;
rb_raise(rb_eArgError, "wrong exec redirect action");
}