From ee870722cf4fab05344a3d0fcd857d8f4fa2eed7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Fri, 3 Mar 2017 18:07:27 +0100 Subject: [PATCH] Shell: fix `Utils.read_file` --- src/minutils/utils.ml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/minutils/utils.ml b/src/minutils/utils.ml index 5cf389265..96891e4b3 100644 --- a/src/minutils/utils.ml +++ b/src/minutils/utils.ml @@ -144,10 +144,7 @@ let read_file ?(bin=false) fn = let ic = (if bin then open_in_bin else open_in) fn in finalize (fun () -> let len = in_channel_length ic in - let buf = Bytes.create len in - let nb_read = input ic buf 0 len in - if nb_read <> len then failwith (Printf.sprintf "read_file: read %d, expected %d" nb_read len) - else Bytes.unsafe_to_string buf) + really_input_string ic len) (fun () -> close_in ic) let write_file ?(bin=false) fn contents =