summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index 3482602326..8b0064b2dc 100644
--- a/io.c
+++ b/io.c
@@ -7058,6 +7058,10 @@ rb_io_reopen(int argc, VALUE *argv, VALUE file)
}
}
+ if (rb_block_given_p()) {
+ return rb_ensure(rb_yield, file, io_close, file);
+ }
+
return file;
}