Skip to content

Commit

Permalink
move close_out for more consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
mhjd committed Aug 27, 2024
1 parent 4ac38bc commit 5dfa8c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/ohow/markdown_builder.ml
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,5 @@ let write_markdown oc s =
output_string oc
(String.concat ""
(Wikicreole.from_string ~sectioning:true () (module MarkdownBuilder) s));
flush oc
flush oc;
close_out oc (* Ensure oc is closed after markdown conversion *)
11 changes: 3 additions & 8 deletions src/ohow/ohow.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,9 @@ let process_file opts output_channel file =
match opts.Global.out_language with
| "md" ->
let content = read_file file in
write_markdown oc content;
close_out oc (* Ensure oc is closed after markdown conversion *)
| "html" ->
ohow ~indent:opts.Global.pretty file oc;
close_out oc (* Ensure oc is closed after HTML conversion *)
| _ ->
ohow ~indent:opts.Global.pretty file oc;
close_out oc)
write_markdown oc content
| "html" -> ohow ~indent:opts.Global.pretty file oc
| _ -> ohow ~indent:opts.Global.pretty file oc)
(* Ensure oc is closed in the default case *)
(* Global.with_current_file file (fun () ->
* get_output_channel output_channel file
Expand Down

0 comments on commit 5dfa8c4

Please sign in to comment.