search for: e30d8eec3

Displaying 1 result from an estimated 1 matches for "e30d8eec3".

2017 Nov 07
0
[PATCH] common/mlstdutils: Add with_openfile function.
...fd = Unix.openfile filename flags perms in + protect ~f:(fun () -> f fd) ~finally:(fun () -> Unix.close fd) + let read_whole_file path = let buf = Buffer.create 16384 in with_open_in path ( diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index 7af6c2111..e30d8eec3 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std_utils.mli @@ -399,6 +399,12 @@ val with_open_out : string -> (out_channel -> 'a) -> 'a return or if the function [f] throws an exception, so this is both safer and more concise than the regular funct...