[macruby-changes] [2569] MacRuby/trunk/io.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Sep 18 18:13:54 PDT 2009


Revision: 2569
          http://trac.macosforge.org/projects/ruby/changeset/2569
Author:   vincent.isambart at gmail.com
Date:     2009-09-18 18:13:53 -0700 (Fri, 18 Sep 2009)
Log Message:
-----------
do not close stdin, stdout or stderr in the finalize

Modified Paths:
--------------
    MacRuby/trunk/io.c

Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c	2009-09-19 00:34:31 UTC (rev 2568)
+++ MacRuby/trunk/io.c	2009-09-19 01:13:53 UTC (rev 2569)
@@ -2837,9 +2837,13 @@
 static void
 rb_objc_io_finalize(void *rcv, SEL sel)
 {
-    rb_io_close((VALUE)rcv);
-    if (rb_objc_io_finalize_super != NULL) {
-	((void(*)(void *, SEL))rb_objc_io_finalize_super)(rcv, sel);
+    rb_io_t *io_struct = ExtractIOStruct((VALUE)rcv);
+    // do not close automatically stdin, stdout and stderr
+    if ((io_struct->fd < 0) || (io_struct->fd > 2)) {
+	rb_io_close((VALUE)rcv);
+	if (rb_objc_io_finalize_super != NULL) {
+	    ((void(*)(void *, SEL))rb_objc_io_finalize_super)(rcv, sel);
+	}
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090918/a0ffdf50/attachment.html>


More information about the macruby-changes mailing list