summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-30 10:32:56 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-10-30 10:32:56 +0000
commitee2718039c143a2668e227b1c5611c41a93da2bb (patch)
tree2361bcaa3da34101eb3a1ca3ac7e583208e8c644 /io.c
parent643f5308e683334aceb2db9656b61f577579effb (diff)
* process.c (redirect_dup2): set standard handles when new fd is stdio,
because if there is no allocated console at the moment Windows does not automatically associate it for child process's standard handle. this is adhoc workaround. reported by Martin Thiede at [ruby-core:48542] [Bug #7239]. * io.c (rb_cloexec_dup2): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index b3c02e99a0..aadd8ecb5b 100644
--- a/io.c
+++ b/io.c
@@ -244,6 +244,10 @@ rb_cloexec_dup2(int oldfd, int newfd)
}
#else
ret = dup2(oldfd, newfd);
+# ifdef _WIN32
+ if (newfd >= 0 && newfd <= 2)
+ SetStdHandle(newfd == 0 ? STD_INPUT_HANDLE : newfd == 1 ? STD_OUTPUT_HANDLE : STD_ERROR_HANDLE, (HANDLE)rb_w32_get_osfhandle(newfd));
+# endif
#endif
if (ret == -1) return -1;
}