Skip to content

Commit cf54cde

Browse files
committed
Don't attempt to trap logs when listing tests
1 parent 7689227 commit cf54cde

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

src/alcotest-engine/core.ml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ module Make (P : Platform.MAKER) (M : Monad.S) = struct
8484
log_trap : Log_trap.t;
8585
}
8686

87-
let empty ~config ~suite_name:unescaped_name =
87+
let empty ~config ~trap_logs ~suite_name:unescaped_name =
8888
let errors = [] in
8989
let suite =
9090
match Suite.v ~name:unescaped_name with
@@ -100,9 +100,9 @@ module Make (P : Platform.MAKER) (M : Monad.S) = struct
100100
Uuidm.v4_gen random_state () |> Uuidm.to_string ~upper:true
101101
in
102102
let log_trap =
103-
match config#verbose with
104-
| true -> Log_trap.inactive
105-
| false ->
103+
match trap_logs with
104+
| false -> Log_trap.inactive
105+
| true ->
106106
Log_trap.active ~root:config#log_dir ~uuid:run_id
107107
~suite_name:(Suite.name suite)
108108
in
@@ -374,7 +374,11 @@ module Make (P : Platform.MAKER) (M : Monad.S) = struct
374374
Config.apply_defaults ~default_log_dir:"<not-shown-to-user>"
375375
(Config.User.create ())
376376
in
377-
let t = register_all (empty ~config ~suite_name:"<not-shown-to-user>") tl in
377+
let t =
378+
register_all
379+
(empty ~config ~trap_logs:false ~suite_name:"<not-shown-to-user>")
380+
tl
381+
in
378382
list_registered_tests t ();
379383
M.return ()
380384

@@ -383,7 +387,7 @@ module Make (P : Platform.MAKER) (M : Monad.S) = struct
383387
let config =
384388
Config.apply_defaults ~default_log_dir:(default_log_dir ()) config
385389
in
386-
let t = empty ~config ~suite_name:name in
390+
let t = empty ~config ~trap_logs:(not config#verbose) ~suite_name:name in
387391
let t = register_all t tl in
388392
let+ test_failures =
389393
(* Only print inside the concurrency monad *)

0 commit comments

Comments
 (0)