]> git.kaiwu.me - quickjs.git/commitdiff
fixed js_std_await() so that it behaves the same way as js_std_loop() (#402)
authorFabrice Bellard <fabrice@bellard.org>
Mon, 28 Apr 2025 14:28:01 +0000 (16:28 +0200)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 28 Apr 2025 14:28:01 +0000 (16:28 +0200)
quickjs-libc.c

index 0788d8c707b8ca55f41f12225720535356718a9b..04684b97851d0fd02e5b1b46a8e1df5c4e00f8b9 100644 (file)
@@ -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;