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)),