From 8f195adff9dc0dce3f966aa05b9118c540f9674c Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 15 Apr 2025 15:51:48 -0400 Subject: [PATCH] feat tef-tldrs: use EMIT_TEF_AT_EXIT --- src/tef-tldrs/trace_tef_tldrs.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/tef-tldrs/trace_tef_tldrs.ml b/src/tef-tldrs/trace_tef_tldrs.ml index 90b4e9f..7d3eb2f 100644 --- a/src/tef-tldrs/trace_tef_tldrs.ml +++ b/src/tef-tldrs/trace_tef_tldrs.ml @@ -96,15 +96,16 @@ let subscriber_ (client : as_client) : Trace_subscriber.t = (* what to do when the collector shuts down *) let finally () = - (* ask the collector to emit the trace in a user-chosen file, perhaps *) - Option.iter - (fun file -> fpf out "EMIT_TEF %s\n" file) - client.emit_tef_at_exit; (try flush out with _ -> ()); try Unix.close sock with _ -> () in fpf out "OPEN %s\n%!" client.trace_id; + (* ask the collector to emit the trace in a user-chosen file, perhaps *) + Option.iter + (fun file -> fpf out "EMIT_TEF_AT_EXIT %s\n" file) + client.emit_tef_at_exit; + Trace_tef.Private_.subscriber_jsonl ~finally ~out:(`Output out) () let subscriber ~out () =