2 * Copyright (c) 2019, Facebook, Inc.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
10 open IndexBuilderTypes
13 let record_in_textfile
15 (symbols
: found_symbol_result list
): unit =
17 (* Open a temporary file *)
18 let open Core_kernel
in
19 let temp_filename = filename ^
".temp" in
20 let channel = Out_channel.create
temp_filename in
22 (* Write lines to file *)
23 List.iter symbols ~f
:(fun symbol
-> begin
24 let kindstr = Printf.sprintf
"%d" (kind_to_int symbol
.found_symbol_kind
) in
25 Out_channel.output_string
channel symbol
.found_symbol_name
;
26 Out_channel.output_string
channel " ";
27 Out_channel.output_string
channel kindstr;
28 Out_channel.output_string
channel "\n";
32 Out_channel.close
channel;
35 let cmdline = Printf.sprintf
"sort -f \"%s\" -o \"%s\""
36 temp_filename filename
in
37 let _ = Unix.system
cmdline in