[bug:trunk] rubyspec: Kernel.spawn redirects both STDERR and STDOUT to the given name ERROR

e$B1sF#$G$9!#e(B

spawn e$B$N%j%@%$%l%/%H$N0z?t$Ge(B :out => “foo”
e$B$H$7$?$H$-!"%U%!%$%ke(B foo e$B$,B8:_e(B
e$B$7$J$1$l$P:n$C$F$/$l$^$9$,!"e(B[:out, :err] => “foo”
e$B$@$H:n$C$F$/$l$^$;$s!#e(B

ruby -e ‘pid = spawn(“echo”, “foo”, [:out, :err] => “foo”);
Proces.wait pid’

e$B$3$l$O0U?^E*$G$7$g$&$+!#e(B
e$B$&$C$H$&$7$$$3$H$K!"e(Brubyspec
e$B$,$3$N5sF0$K0MB8$7$F<:GT$9$k$h$&$K$J$j$^$7$?!#e(B

e$BG[Ns$NCf$,$9$Y$Fe(B :out e$B$+e(B :err e$B$@$C$?$ie(B O_CREAT|O_TRUNC
e$B$K$9$k%Q%C%A$G$9!#e(B
e$BH?BP$,$J$1$l$P%3%_%C%H$7$^$9!#e(B

diff --git a/process.c b/process.c
index 9e52392…4ca6ed3 100644
— a/process.c
+++ b/process.c
@@ -1342,7 +1342,19 @@ check_exec_redirect(VALUE key, VALUE val, VALUE
options)
key = check_exec_redirect_fd(key);
if (FIXNUM_P(key) && (FIX2INT(key) == 1 || FIX2INT(key) == 2))
flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);

  •    else
    
  •    else if (TYPE(key) == T_ARRAY) {
    
  •  int i;
    
  •  for (i = 0; i < RARRAY_LEN(key); i++) {
    
  • VALUE v = RARRAY_PTR(key)[i];
  • VALUE fd = check_exec_redirect_fd(v);
  • if (FIX2INT(fd) != 1 && FIX2INT(fd) != 2) break;
  •  }
    
  •  if (i == RARRAY_LEN(key))
    
  • flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
  •  else
    
  • flags = INT2NUM(O_RDONLY);
  • }
  • else
    flags = INT2NUM(O_RDONLY);
    perm = INT2FIX(0644);
    param = hide_obj(rb_ary_new3(3, hide_obj(rb_str_dup(path)),

2010e$BG/e(B5e$B7ne(B27e$BF|e(B5:14 Yusuke ENDOH [email protected]:

e$BH?BP$,$J$1$l$P%3%_%C%H$7$^$9!#e(B
e$B$=$N5sF0$O0-$/$J$$$H;W$$$^$9$,!"e(B1.9.1 e$B$HHs8_49$G$9$M$'!#e(B

e$B1sF#$G$9!#e(B

2010e$BG/e(B5e$B7ne(B27e$BF|e(B6:54 Tanaka A. [email protected]:

e$BG[Ns$NCf$,$9$Y$Fe(B :out e$B$+e(B :err e$B$@$C$?$ie(B O_CREAT|O_TRUNC e$B$K$9$k%Q%C%A$G$9!#e(B
e$BH?BP$,$J$1$l$P%3%_%C%H$7$^$9!#e(B

e$B$=$N5sF0$O0-$/$J$$$H;W$$$^$9$,!"e(B1.9.1 e$B$HHs8_49$G$9$M$'!#e(B

e$B$&!<$s!#$=$&$G$9$M$(!#e(B

:out => “foo”, :err => “foo” e$B$O$I$&$J$k$Y$-$+$H$+!“e(B[:in, :out] =>
“foo”
e$B$K$O2?$r4|BT$9$k$N$+$H$+!”;EMM%l%Y%k$G8!F$$7$J$$$H9T$1$J$$5$$,$7$F$-$?$Ne(B
e$B$G!“$3$3$@$1>G$C$FD>$9I,MW$O$J$$5$$,$7$F$-$^$7$?!#e(B
e$B$3$N%A%1%C%H$Oe(B 1.9.x e$B$K$7$F!”:#$Oe(B rubyspec
e$BB&$r=$@5$7$F$*$-$^$9!#e(B