aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/grep.ml19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/grep.ml b/lib/grep.ml
index 7e5c3b9..0b3c10b 100644
--- a/lib/grep.ml
+++ b/lib/grep.ml
@@ -111,17 +111,16 @@ let pretty_format parsed_headlines =
let get_full_content_command file = [ "cat"; file ]
+let read_whole_file filename =
+ (* open_in_bin works correctly on Unix and Windows *)
+ let ch = open_in_bin filename in
+ let s = really_input_string ch (in_channel_length ch) in
+ close_in ch;
+ s
+
+
let get_full_file_content_content file =
- let open Shexp_process in
- let open Shexp_process.Infix in
- ( file
- , eval
- (chdir
- execution_directory
- (find_sort_name ()
- |- call headline_args
- |- call (get_full_content_command file)
- |- read_all)) )
+ file, read_whole_file (execution_directory ^ "/" ^ file)
let parse_full_content files =