Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fri, 1 Oct 2010 06:13:32 +0000 usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe…

…69b080e>

 merge revision(s) 29382:
 ?\012
 	* win32/win32.c (init_stdhandle): redirect unopened IOs to NUL.
 	  backport r11362 from trunk. [ruby-core:31445]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@29382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Signed-off-by: URABE, Shyouhei <shyouhei@ruby-lang.org>



git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7@29862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
commit 6ae1da5709d246765ffd1742f9f64f29fef899ac 1 parent 8ea3df5
@shyouhei shyouhei authored
Showing with 27 additions and 4 deletions.
  1. +5 −0 ChangeLog
  2. +1 −1  version.h
  3. +21 −3 win32/win32.c
View
5 ChangeLog
@@ -1,3 +1,8 @@
+Fri Oct 1 15:12:05 2010 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (init_stdhandle): redirect unopened IOs to NUL.
+ backport r11362 from trunk. [ruby-core:31445]
+
Mon Aug 23 11:42:41 2010 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* ext/openssl/ossl_asn1.c (obj_to_asn1bool): fixed ASN1::Boolean
View
2  version.h
@@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2010-11-22"
#define RUBY_VERSION_CODE 187
#define RUBY_RELEASE_CODE 20101122
-#define RUBY_PATCHLEVEL 311
+#define RUBY_PATCHLEVEL 312
#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
View
24 win32/win32.c
@@ -1883,15 +1883,33 @@ rb_w32_open_osfhandle(long osfhandle, int flags)
static void
init_stdhandle(void)
{
+ int nullfd = -1;
+ int keep = 0;
+#define open_null(fd) \
+ (((nullfd < 0) ? \
+ (nullfd = open("NUL", O_RDWR|O_BINARY)) : 0), \
+ ((nullfd == (fd)) ? (keep = 1) : dup2(nullfd, fd)), \
+ (fd))
+
if (fileno(stdin) < 0) {
- stdin->_file = 0;
+ stdin->_file = open_null(0);
+ }
+ else {
+ setmode(fileno(stdin), O_BINARY);
}
if (fileno(stdout) < 0) {
- stdout->_file = 1;
+ stdout->_file = open_null(1);
+ }
+ else {
+ setmode(fileno(stdout), O_BINARY);
}
if (fileno(stderr) < 0) {
- stderr->_file = 2;
+ stderr->_file = open_null(2);
+ }
+ else {
+ setmode(fileno(stderr), O_BINARY);
}
+ if (nullfd >= 0 && !keep) close(nullfd);
setvbuf(stderr, NULL, _IONBF, 0);
}
#else
Please sign in to comment.
Something went wrong with that request. Please try again.