Modified: MacRuby/branches/experimental/io.c (1266 => 1267)
--- MacRuby/branches/experimental/io.c 2009-03-30 16:51:22 UTC (rev 1266)
+++ MacRuby/branches/experimental/io.c 2009-03-30 17:06:29 UTC (rev 1267)
@@ -366,10 +366,10 @@
static bool
rb_io_is_open(rb_io_t *io_struct)
{
- return (io_struct->readStream == NULL
- || CFReadStreamGetStatus(io_struct->readStream) == kCFStreamStatusOpen)
- && (io_struct->writeStream == NULL
- || CFWriteStreamGetStatus(io_struct->writeStream) == kCFStreamStatusOpen);
+ // Either the readStream or the writeStream must be not null and open.
+ return ((io_struct->readStream == NULL) ?
+ (io_struct->writeStream != NULL && CFWriteStreamGetStatus(io_struct->writeStream) == kCFStreamStatusOpen) :
+ (CFReadStreamGetStatus(io_struct->readStream) == kCFStreamStatusOpen));
}
static bool
@@ -863,6 +863,9 @@
rb_io_fileno(VALUE io, SEL sel)
{
rb_io_t *io_struct = ExtractIOStruct(io);
+ if(!rb_io_is_open(io_struct)) {
+ rb_raise(rb_eIOError, "closed stream");
+ }
return INT2FIX(io_struct->fd);
}
Modified: MacRuby/branches/experimental/rakelib/spec.rake (1266 => 1267)
--- MacRuby/branches/experimental/rakelib/spec.rake 2009-03-30 16:51:22 UTC (rev 1266)
+++ MacRuby/branches/experimental/rakelib/spec.rake 2009-03-30 17:06:29 UTC (rev 1267)
@@ -29,6 +29,8 @@
KNOWN_GOOD_CORE_IO = %w{
closed
+ to_i
+ to_io
}
desc "Run all language known good spec files which should be fully green (does not use tags)"