Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno hangs on stdout.write #5515

Closed
millsp opened this issue May 16, 2020 · 2 comments
Closed

Deno hangs on stdout.write #5515

millsp opened this issue May 16, 2020 · 2 comments

Comments

@millsp
Copy link

millsp commented May 16, 2020

I've noticed that Deno process never ends on this code

const te = new TextEncoder();

for (const file of files) {
  Deno.stdout.write(te.encode(file + "\n"));
}

console.log("end"); // never reaches

Where files is a very long list of file paths from my PC.

@jdiamond
Copy link

I think the write method is async. Can you try await'ing on each write? Might give the event loop a chance to breathe.

@cknight
Copy link
Contributor

cknight commented May 17, 2020

As stated above, write is async and doesn't do well with a flood of requests all at once. Either await the write or switch to writeSync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants