aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/file.c b/file.c
index 02143a147e..3594bbd431 100644
--- a/file.c
+++ b/file.c
@@ -4244,7 +4244,11 @@ rb_file_truncate(VALUE obj, VALUE len)
if (!(fptr->mode & FMODE_WRITABLE)) {
rb_raise(rb_eIOError, "not opened for writing");
}
+#ifndef _WIN32
rb_io_flush(obj);
+#else
+ rb_io_flush_raw(obj, 0);
+#endif
#ifdef HAVE_FTRUNCATE
if (ftruncate(fptr->fd, pos) < 0)
rb_sys_fail_path(fptr->pathv);