fix spurious \r

This commit is contained in:
Simon Cruanes 2022-08-27 12:36:45 -04:00
parent f0041f9dae
commit 5f91d0bd76
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 3 additions and 5 deletions

View file

@ -33,7 +33,6 @@ let p_progress = ref false
let proof_file = ref "" let proof_file = ref ""
let proof_store_memory = ref false let proof_store_memory = ref false
let proof_store_file = ref "" let proof_store_file = ref ""
let reset_line = "\x1b[2K\r"
(* Arguments parsing *) (* Arguments parsing *)
let int_arg r arg = let int_arg r arg =
@ -184,7 +183,7 @@ let main_smt ~config () : _ result =
in in
let finally () = let finally () =
if !p_stat then Format.printf "%s%a@." reset_line Solver.pp_stats solver if !p_stat then Format.printf "%a@." Solver.pp_stats solver
in in
CCFun.protect ~finally @@ fun () -> CCFun.protect ~finally @@ fun () ->
(* FIXME: emit an actual proof *) (* FIXME: emit an actual proof *)

View file

@ -152,7 +152,7 @@ let solve ?gc:_ ?restarts:_ ?proof_file ?(pp_model = false) ?(check = false)
Some (mk_progress s) Some (mk_progress s)
else else
None None
in and clear_line () = if progress then Printf.printf "%s%!" reset_line in
let should_stop = let should_stop =
match time, memory with match time, memory with
@ -181,7 +181,6 @@ let solve ?gc:_ ?restarts:_ ?proof_file ?(pp_model = false) ?(check = false)
(* ?gc ?restarts ?time ?memory ?progress *) (* ?gc ?restarts ?time ?memory ?progress *)
in in
let t2 = Sys.time () in let t2 = Sys.time () in
Printf.printf "\r";
flush stdout; flush stdout;
(match res with (match res with
| Solver.Sat m -> | Solver.Sat m ->
@ -234,7 +233,7 @@ let solve ?gc:_ ?restarts:_ ?proof_file ?(pp_model = false) ?(check = false)
Fmt.printf "unknown@."; Fmt.printf "unknown@.";
Fmt.printf "; @[<h>:reason %a@]@." Solver.Unknown.pp reas Fmt.printf "; @[<h>:reason %a@]@." Solver.Unknown.pp reas
| exception exn -> | exception exn ->
Printf.printf "%s%!" reset_line; clear_line ();
raise exn); raise exn);
res res