From 051d7bc8dbfca584789ae8e9c1c393aea3aa72b7 Mon Sep 17 00:00:00 2001 From: ksss Date: Mon, 12 Jun 2017 09:50:51 +0900 Subject: Reseek when write --- mrblib/io.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mrblib') diff --git a/mrblib/io.rb b/mrblib/io.rb index 694fdb0c9..3ef9c7b5d 100644 --- a/mrblib/io.rb +++ b/mrblib/io.rb @@ -123,6 +123,10 @@ class IO def write(string) str = string.is_a?(String) ? string : string.to_s return str.size unless str.size > 0 + if 0 < @buf.length + # reset real pos ignore buf + seek(pos, SEEK_SET) + end len = syswrite(str) @pos += len len -- cgit v1.2.3