In Ruby, I can write contents to a file at path as simply as:
IO.write path, contents, :mode => 'w+'
However, the documentation does not specify what kind of exceptions may be raised. In C, if a program encounters EAGAIN or EINTR, it usually tries to write to the file again. Are we supposed to do the same in Ruby (by catching Errno::EINTR and Errno::EAGAIN)? I would kinda expect there to be a higher-level abstraction in a language like Ruby. What is the correct pattern to use here?
(on the same note, do we have to worry about short counts in Ruby?)
After some more digging, I found (as expected) that Ruby handles short counts and
EAGAINautomatically. The appropriate code is in io.c.