0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

test(cli): ensure await Promise.all does not race (#8868)

This commit is contained in:
Casper Beyer 2020-12-26 21:29:46 +08:00 committed by GitHub
parent c1fdb30394
commit e8587c86bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -1,3 +1 @@
done
done
complete
Hello, world!

View file

@ -1,8 +1,8 @@
const encoder = new TextEncoder();
const pending = [
Deno.stdout.write(encoder.encode("done\n")),
Deno.stdout.write(encoder.encode("done\n")),
Deno.stdout.write(encoder.encode("Hello, ")),
Deno.stdout.write(encoder.encode("world!")),
];
await Promise.all(pending);
await Deno.stdout.write(encoder.encode("complete\n"));
await Deno.stdout.write(encoder.encode("\n"));