From 894ce9de1c76acb6b84385e152ff1cd6cb6626bd Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Mon, 28 Apr 2025 16:28:01 +0200 Subject: [PATCH] fixed js_std_await() so that it behaves the same way as js_std_loop() (#402) --- quickjs-libc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quickjs-libc.c b/quickjs-libc.c index 0788d8c..04684b9 100644 --- a/quickjs-libc.c +++ b/quickjs-libc.c @@ -4109,8 +4109,10 @@ JSValue js_std_await(JSContext *ctx, JSValue obj) if (err < 0) { js_std_dump_error(ctx1); } - if (os_poll_func) - os_poll_func(ctx); + if (err == 0) { + if (os_poll_func) + os_poll_func(ctx); + } } else { /* not a promise */ ret = obj;