Created
September 8, 2011 20:11
-
-
Save nanki/1204536 to your computer and use it in GitHub Desktop.
io-console for jruby.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- console.c.orig 2011-09-09 04:59:09.000000000 +0900 | |
+++ console.c 2011-09-09 05:08:30.000000000 +0900 | |
@@ -4,6 +4,9 @@ | |
*/ | |
#include "ruby.h" | |
#include "rubyio.h" | |
+ | |
+#include <errno.h> | |
+ | |
#ifndef HAVE_RB_IO_T | |
typedef OpenFile rb_io_t; | |
#endif | |
@@ -380,7 +383,11 @@ | |
if (rb_const_defined(klass, id_console)) { | |
con = rb_const_get(klass, id_console); | |
if (TYPE(con) == T_FILE) { | |
+#ifdef JRUBY | |
+ if ((fptr = jruby_io_struct(con)) && GetReadFD(fptr) != -1) | |
+#else | |
if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1) | |
+#endif | |
return con; | |
} | |
rb_mod_remove_const(klass, ID2SYM(id_console)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment