@@ -707,6 +707,9 @@ val copy_file_chunk: in_channel -> out_channel -> int -> unit
707
707
val string_of_file: in_channel -> string
708
708
(* [string_of_file ic] reads the contents of file [ic] and copies
709
709
them to a string. It stops when encountering EOF on [ic]. *)
710
+
711
+ val output_to_bin_file_directly: string -> (string -> out_channel -> 'a) -> 'a
712
+
710
713
val output_to_file_via_temporary:
711
714
?mode:open_flag list -> string -> (string -> out_channel -> 'a) -> 'a
712
715
(* Produce output in temporary file, then rename it
@@ -1206,6 +1209,12 @@ let string_of_file ic =
1206
1209
(Buffer.add_subbytes b buff 0 n; copy())
1207
1210
in copy()
1208
1211
1212
+ let output_to_bin_file_directly filename fn =
1213
+ let oc = Pervasives.open_out_bin filename in
1214
+ match fn filename oc with
1215
+ | v -> close_out oc ; v
1216
+ | exception e -> close_out oc ; raise e
1217
+
1209
1218
let output_to_file_via_temporary ?(mode = [Open_text]) filename fn =
1210
1219
let (temp_filename, oc) =
1211
1220
Filename.open_temp_file
@@ -57055,8 +57064,9 @@ let record_value_dependency vd1 vd2 =
57055
57064
57056
57065
let save_cmt filename modname binary_annots sourcefile initial_env cmi =
57057
57066
if !Clflags.binary_annotations && not !Clflags.print_types then begin
57067
+ (if !Clflags.bs_only then Misc.output_to_bin_file_directly else
57058
57068
Misc.output_to_file_via_temporary
57059
- ~mode:[Open_binary] filename
57069
+ ~mode:[Open_binary] ) filename
57060
57070
(fun temp_file_name oc ->
57061
57071
let this_crc =
57062
57072
match cmi with
0 commit comments