From b7eeca15af401005101eb8db58cdab3efe9df4c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Vouillon?= Date: Tue, 19 Dec 2023 17:17:55 +0100 Subject: [PATCH] Runtime: ignore exception when closing a channel --- runtime/wasm/io.wat | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runtime/wasm/io.wat b/runtime/wasm/io.wat index 9eb222851..6c93a15da 100644 --- a/runtime/wasm/io.wat +++ b/runtime/wasm/io.wat @@ -270,7 +270,12 @@ (struct.set $channel $fd (local.get $ch) (i32.const -1)) (call $unregister_channel (local.get $ch)) (call $release_fd_offset (local.get $fd)) - (call $close (local.get $fd)))) + (try + (do + (call $close (local.get $fd))) + (catch $javascript_exception + ;; ignore exception + (drop (pop externref)))))) (ref.i31 (i32.const 0))) (func $caml_do_read