1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-29 18:49:07 -05:00
denoland-deno/tests/specs/run/stdout_write_all/stdout_write_all.ts
2024-11-05 06:39:05 +00:00

13 lines
394 B
TypeScript

const encoder = new TextEncoder();
const pending = [];
// do this a bunch of times to ensure it doesn't race
// and everything happens in order
for (let i = 0; i < 100; i++) {
pending.push(Deno.stdout.write(encoder.encode("Hello, ")));
pending.push(Deno.stdout.write(encoder.encode(`world! ${i}`)));
pending.push(Deno.stdout.write(encoder.encode("\n")));
}
await Promise.all(pending);