Should raise SyscallError on IO#syswrite
instead of IOError
MODIFY
mrblib/io.rb
mrblib/io.rb
@@ -123,14 +123,9 @@ class IO
def write(string)
str = string.is_a?(String) ? string : string.to_s
return str.size unless str.size > 0
-
len = syswrite(str)
- if len != -1
@pos += len
- return len
- end
-
- raise IOError
+ len
end
def <<(str)

MODIFY
src/io.c
src/io.c
@@ -705,6 +705,9 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
fd = fptr->fd2;
}
length = write(fd, RSTRING_PTR(buf), RSTRING_LEN(buf));
+ if (length == -1) {
+ mrb_sys_fail(mrb, 0);
+ }
return mrb_fixnum_value(length);
}

Should raise SyscallError on IO#syswrite

instead of IOError