e$B$J$+$@$G$9!#e(B
[ruby-dev:30679]e$B$K4XO"$7$F!“e(Bwin32e$B$J$I$Ne(Bforke$B$N$J$$4D6-$G$Oe(B
IO.popen(”-")e$B$Oe(Bforke$BF1MMe(BNotImplementedErrore$B$K$J$k$Y$-$8$c$J$$$Ge(B
e$B$7$g$&$+!#e(B
Index: io.c
— io.c (revision 12141)
+++ io.c (working copy)
@@ -3057,9 +3057,9 @@ pipe_open(int argc, VALUE *argv, const c
int status;
struct popen_arg arg;
- volatile int doexec;
#elif defined(_WIN32)
int openmode = rb_io_mode_modenum(mode);
char *exename = NULL;
#endif
- volatile int doexec;
char *cmd;
FILE *fp = 0;
@@ -3072,7 +3072,8 @@ pipe_open(int argc, VALUE *argv, const c
}
-#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR)
cmd = StringValueCStr(prog);
doexec = (strcmp("-", cmd) != 0);
+
+#if defined(HAVE_FORK) && defined(HAVE_SOCKETPAIR)
if (!doexec) {
fflush(stdin); /* is it really needed? */
@@ -3134,4 +3135,5 @@ pipe_open(int argc, VALUE *argv, const c
}
#elif defined(_WIN32)
- if (!doexec) rb_notimplement();
if (argc) {
char **args = ALLOCA_N(char *, argc+1);
@@ -3146,7 +3148,4 @@ pipe_open(int argc, VALUE *argv, const c
exename = RSTRING_PTR(prog);
}
- else {
- cmd = StringValueCStr(prog);
- }
while ((pid = rb_w32_pipe_exec(cmd, exename, openmode, &fd)) == -1)
{
/* exec failed */
@@ -3164,7 +3163,10 @@ pipe_open(int argc, VALUE *argv, const c
}
#else - if (argc)
- if (!doexec) rb_notimplement();
- if (argc) {
prog = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
- fp = popen(StringValueCStr(prog), mode);
- cmd = StringValueCStr(prog);
- }
- fp = popen(cmd, mode);
if (!fp) rb_sys_fail(RSTRING_PTR(prog));
fd = fileno(fp);