@@ -707,6 +707,9 @@ val copy_file_chunk: in_channel -> out_channel -> int -> unit
707707val string_of_file: in_channel -> string
708708 (* [string_of_file ic] reads the contents of file [ic] and copies
709709 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+
710713val output_to_file_via_temporary:
711714 ?mode:open_flag list -> string -> (string -> out_channel -> 'a) -> 'a
712715 (* Produce output in temporary file, then rename it
@@ -1206,6 +1209,12 @@ let string_of_file ic =
12061209 (Buffer.add_subbytes b buff 0 n; copy())
12071210 in copy()
12081211
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+
12091218let output_to_file_via_temporary ?(mode = [Open_text]) filename fn =
12101219 let (temp_filename, oc) =
12111220 Filename.open_temp_file
@@ -57055,8 +57064,9 @@ let record_value_dependency vd1 vd2 =
5705557064
5705657065let save_cmt filename modname binary_annots sourcefile initial_env cmi =
5705757066 if !Clflags.binary_annotations && not !Clflags.print_types then begin
57067+ (if !Clflags.bs_only then Misc.output_to_bin_file_directly else
5705857068 Misc.output_to_file_via_temporary
57059- ~mode:[Open_binary] filename
57069+ ~mode:[Open_binary] ) filename
5706057070 (fun temp_file_name oc ->
5706157071 let this_crc =
5706257072 match cmi with
0 commit comments