wrap read/write in begin/rescue

git-svn-id: file:///home/svn/incoming/trunk@3086 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2005-11-24 19:38:36 +00:00
parent 08e3078d47
commit f91281f990
1 changed files with 14 additions and 2 deletions

View File

@ -28,14 +28,26 @@ module Stream
# This method writes the supplied buffer to the stream.
#
def write(buf, opts = {})
begin
fd.syswrite(buf)
rescue IOError
return 0 if (fd.abortive_close == true)
raise $!
end
end
#
# This method reads data of the supplied length from the stream.
#
def read(length = nil, opts = {})
begin
fd.sysread(length)
rescue IOError
return 0 if (fd.abortive_close == true)
raise $!
end
end
#