summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabrice Bellard <fabrice@bellard.org>2025-04-28 16:28:01 +0200
committerFabrice Bellard <fabrice@bellard.org>2025-04-28 16:28:01 +0200
commit894ce9de1c76acb6b84385e152ff1cd6cb6626bd (patch)
tree34576e0e25860f5846cda187fc6165ae5fb5b570
parent19abf1888db5884a5758036ff6e7fa2b340acedc (diff)
downloadquickjs-894ce9de1c76acb6b84385e152ff1cd6cb6626bd.tar.gz
quickjs-894ce9de1c76acb6b84385e152ff1cd6cb6626bd.zip
fixed js_std_await() so that it behaves the same way as js_std_loop() (#402)
-rw-r--r--quickjs-libc.c6
1 files 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;