[Bug #2541] fork のない環境での spawn による未使用 fd へのリダイレクト

Bug #2541: fork e$B$N$J$$4D6-$G$Ne(B spawn e$B$K$h$kL$;HMQe(B fd
e$B$X$N%j%@%$%l%/%He(B
http://redmine.ruby-lang.org/issues/show/2541

e$B5/I<<Te(B: _ wanabe
e$B%9%F!<%?%9e(B: Open, e$BM%@hEYe(B: Low
e$B%+%F%4%je(B: core, Target version: 1.9.x
ruby -v: ruby 1.9.2dev (2009-12-31 trunk 26211) [i386-mingw32]

fork e$B$N$J$$4D6-$Ge(B spawn e$B$9$k$H$-!"L$;HMQ$Ne(B fd
e$B$X%j%@%$%l%/%H$7$h$&$H$9$k$He(B
EBADF e$BNc30$,H/@8$7$F$7$^$$$^$9!#e(B
save_redirect_fd() e$BCf$Ne(B redirect_dup()
e$B$NLa$jCM$N%A%%C%/$G0z$C$+$+$C$F$$$k$h$&$G$9!#e(B

$ ruby -ve spawn(echo foo, 10=>STDOUT)
ruby 1.9.2dev (2009-12-31 trunk 26211) [i386-mingw32]
-e:1:in spawn': Bad file descriptor - dup (Errno::EBADF) from -e:1:in