Skip to content

Commit

Permalink
restore the emit_event io buffer
Browse files Browse the repository at this point in the history
the io library copies this into an internal buffer as i expected, this wasn't the source of any data corruption
  • Loading branch information
emberian committed Jan 10, 2024
1 parent b0f95a0 commit 6a675bb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib/o1trace/webkit_event/o1trace_webkit_event.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ module Scheduler = Async_kernel_scheduler

let current_wr = ref None

let emit_event' wr event =
let emit_event' =
let buf = Bigstring.create 512 in
try Webkit_trace_event_binary_output.emit_event ~buf wr event
with exn ->
Writer.writef wr "failed to write o1trace event: %s\n" (Exn.to_string exn)
fun wr event ->
try Webkit_trace_event_binary_output.emit_event ~buf wr event
with exn ->
Writer.writef wr "failed to write o1trace event: %s\n" (Exn.to_string exn)

let emit_event event =
Option.iter !current_wr ~f:(fun wr -> emit_event' wr event)
Expand Down

0 comments on commit 6a675bb

Please sign in to comment.