let bracket_tmpfile ?(prefix="ounit-") ?(suffix=".txt") ?mode test_ctxt =
create
(fun test_ctxt ->
let suffix = "-"^(OUnitTest.get_shard_id test_ctxt)^suffix in
let (fn, chn) = Filename.open_temp_file ?mode prefix suffix in
logf test_ctxt.test_logger `Info "Created a temporary file: %S." fn;
(fn, chn))
(fun (fn, chn) test_ctxt ->
(try close_out chn with _ -> ());
try
Sys.remove fn;
logf test_ctxt.test_logger `Info "Removed a temporary file: %S." fn
with _ ->
())
test_ctxt