deno_std
deno_std copied to clipboard
Top-level await promise never resolved
https://deno.land/[email protected]/examples/os_signals
According to your documentation, I run and report an error
import { signal } from "https://deno.land/[email protected]/signal/mod.ts";
// Windows 只支持 SIGINT 和 SIGBREAK
const sig = signal("SIGBREAK", "SIGINT");
// Add a timeout to prevent process exiting immediately.
setTimeout(() => {}, 5000);
for await (const _ of sig) {
console.log("顶级等待承诺从未解决");
}
error: Top-level await promise never resolved
for await (const _ of sig) {
^
at
What version of Deno are you using? What command are you using to run this code snippet? The documentation example works fine on my Mac (running Deno 1.30.0
)
I believe this is not a bug but the expected behavior in this case. I made an issue for the same thing a while back (note that the error message was different then): https://github.com/denoland/deno_std/issues/1941#issuecomment-1061293369
# 13697 @ donglufei in E:\test\deno\deno01 [13:18:53]
$ deno run -A index.js
error: Top-level await promise never resolved
for await (const _ of sig) {
^
at <anonymous> (file:///E:/test/deno/deno01/index.js:146:18)
# 13697 @ donglufei in E:\test\deno\deno01 [13:19:02] C:1
$ deno -V
deno 1.30.0
# 13697 @ donglufei in E:\test\deno\deno01 [13:19:07]
$ deno run -A index.js
error: Top-level await promise never resolved
for await (const _ of sig) {
^
at <anonymous> (file:///E:/test/deno/deno01/index.js:146:18)
# 13697 @ donglufei in E:\test\deno\deno01 [13:19:14] C:1
Closing this as std/signals
was deprecated and removed from the Standard Library a while ago. Please take a look at the OS Signals documentation. If the code there doesn't work for your use case, please open a ticket in https://github.com/denoland/deno-docs.