Skip to content

Commit

Permalink
Flush before changing binary mode on Windows, for output to reflect p…
Browse files Browse the repository at this point in the history
…rev mode
  • Loading branch information
jmid committed Jan 5, 2024
1 parent 6c0f018 commit 86019b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/io/stm_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ struct
| Output_bytes b -> Res (result unit exn, protect (Out_channel.output_bytes oc) b)
| Output (b,p,l) -> Res (result unit exn, protect (Out_channel.output oc b p) l)
| Output_substring (s,p,l) -> Res (result unit exn, protect (Out_channel.output_substring oc s p) l)
| Set_binary_mode b -> Res (unit, Out_channel.set_binary_mode oc b)
| Set_binary_mode b ->
if Sys.win32 || Sys.cygwin
then Res (unit, (Out_channel.flush oc; Out_channel.set_binary_mode oc b)) (* flush before changing mode *)
else Res (unit, Out_channel.set_binary_mode oc b)
| Set_buffered b -> Res (unit, Out_channel.set_buffered oc b)
| Is_buffered -> Res (bool, Out_channel.is_buffered oc)

Expand Down

0 comments on commit 86019b9

Please sign in to comment.