[前][次][番号順一覧][スレッド一覧]

ruby-changes:32259

From: usa <ko1@a...>
Date: Sun, 22 Dec 2013 14:33:53 +0900 (JST)
Subject: [ruby-changes:32259] usa:r44338 (ruby_1_9_3): merge revision(s) 37388: [Backport #9232]

usa	2013-12-22 14:33:46 +0900 (Sun, 22 Dec 2013)

  New Revision: 44338

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44338

  Log:
    merge revision(s) 37388: [Backport #9232]
    
    * 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.

  Modified directories:
    branches/ruby_1_9_3/
  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/process.c
    branches/ruby_1_9_3/version.h
Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 44337)
+++ ruby_1_9_3/ChangeLog	(revision 44338)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/ChangeLog#L1
+Sun Dec 22 14:25:54 2013  NAKAMURA Usaku  <usa@r...>
+
+	* 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].
+
 Tue Dec  3 18:36:42 2013  Narihiro Nakamura  <authornari@g...>
 
 	* object.c (rb_obj_clone): protect FL_MARK of a dest object. A lazy
Index: ruby_1_9_3/process.c
===================================================================
--- ruby_1_9_3/process.c	(revision 44337)
+++ ruby_1_9_3/process.c	(revision 44338)
@@ -1949,16 +1949,28 @@ redirect_dup(int oldfd) https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/process.c#L1949
     ttyprintf("dup(%d) => %d\n", oldfd, ret);
     return ret;
 }
+#else
+#define redirect_dup(oldfd) dup(oldfd)
+#endif
 
+#if defined(DEBUG_REDIRECT) || defined(_WIN32)
 static int
 redirect_dup2(int oldfd, int newfd)
 {
     int ret;
     ret = dup2(oldfd, newfd);
+    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));
+#if defined(DEBUG_REDIRECT)
     ttyprintf("dup2(%d, %d)\n", oldfd, newfd);
+#endif
     return ret;
 }
+#else
+#define redirect_dup2(oldfd, newfd) dup2((oldfd), (newfd))
+#endif
 
+#if defined(DEBUG_REDIRECT)
 static int
 redirect_close(int fd)
 {
@@ -1978,8 +1990,6 @@ redirect_open(const char *pathname, int https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/process.c#L1990
 }
 
 #else
-#define redirect_dup(oldfd) dup(oldfd)
-#define redirect_dup2(oldfd, newfd) dup2((oldfd), (newfd))
 #define redirect_close(fd) close(fd)
 #define redirect_open(pathname, flags, perm) open((pathname), (flags), (perm))
 #endif
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 44337)
+++ ruby_1_9_3/version.h	(revision 44338)
@@ -1,5 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/ruby_1_9_3/version.h#L1
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 487
+#define RUBY_PATCHLEVEL 488
 
 #define RUBY_RELEASE_DATE "2013-12-22"
 #define RUBY_RELEASE_YEAR 2013

Property changes on: ruby_1_9_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r37388


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]