- let stream =
- try
- Stream.of_channel (try_open_in opts.include_paths path)
- with Sys_error _ -> raise (UnableToInclude path)
- in
- let status = ref status in
- !eval_from_stream_ref status stream (fun _ _ -> ());
- !status
+ (try
+ let ic = try_open_in ~f:open_in opts.include_paths path in
+ let stream = Stream.of_channel ic in
+ let status = ref status in
+ !eval_from_stream_ref status stream (fun _ _ -> ());
+ close_in ic;
+ !status
+ with Sys_error _ -> raise (UnableToInclude path))