You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Compile and run
let x = object
method input s pos len = raise End_of_file
method close_in () = ()
end
let () =
let input = IO.from_in_channel x in
let _ = IO.read_all input in
()
What is the expected output? What do you see instead?
Expect read_all to return empty string.
Instead exception is raised:
Fatal error: exception End_of_file
What version of the product are you using? On what operating system?
1.5.1, WinXP, ocaml-3.11.0
Please provide any additional information below.
The code in question
let from_in_channel ch =
let cbuf = String.create 1 in
let read() =
try
if ch#input cbuf 0 1 = 0 then raise Sys_blocked_io;
String.unsafe_get cbuf 0
with
End_of_file -> raise No_more_input
in
let input s p l =
ch#input s p l
in
create_in
~read
~input
~close:ch#close_in
Looks like input should catch End_of_file and convert it to No_more_input
try
ch#input s p l
with
End_of_file -> raise No_more_input
The same goes for other methods. I could prepare a patch if you like.
Reported by ygrekheretix on 2009-07-16 11:58:53
The text was updated successfully, but these errors were encountered:
Originally reported on Google Code with ID 11
Reported by
ygrekheretix
on 2009-07-16 11:58:53The text was updated successfully, but these errors were encountered: