mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 19:25:28 -05:00
bugfix in CCFormat.to_file
This commit is contained in:
parent
a389b49f43
commit
88fca4efa1
2 changed files with 3 additions and 1 deletions
|
|
@ -134,6 +134,7 @@ let _with_file_out filename f =
|
||||||
begin try
|
begin try
|
||||||
let x = f fmt in
|
let x = f fmt in
|
||||||
Format.pp_print_flush fmt ();
|
Format.pp_print_flush fmt ();
|
||||||
|
close_out oc;
|
||||||
x
|
x
|
||||||
with e ->
|
with e ->
|
||||||
Format.pp_print_flush fmt ();
|
Format.pp_print_flush fmt ();
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ let _with_file_out filename f =
|
||||||
let oc = open_out filename in
|
let oc = open_out filename in
|
||||||
begin try
|
begin try
|
||||||
let x = f oc in
|
let x = f oc in
|
||||||
|
close_out oc;
|
||||||
x
|
x
|
||||||
with e ->
|
with e ->
|
||||||
close_out_noerr oc;
|
close_out_noerr oc;
|
||||||
|
|
@ -148,7 +149,7 @@ let _with_file_out filename f =
|
||||||
end
|
end
|
||||||
|
|
||||||
let to_file filename format =
|
let to_file filename format =
|
||||||
_with_file_out filename (fun oc -> kfprintf (fun _ -> close_out oc) oc format)
|
_with_file_out filename (fun oc -> fprintf oc format)
|
||||||
|
|
||||||
(** {2 Monadic IO} *)
|
(** {2 Monadic IO} *)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue