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

console.clear is not synchronous #3532

Closed
dev-nicolaos opened this issue Dec 21, 2019 · 0 comments · Fixed by #3533
Closed

console.clear is not synchronous #3532

dev-nicolaos opened this issue Dec 21, 2019 · 0 comments · Fixed by #3533

Comments

@dev-nicolaos
Copy link
Contributor

dev-nicolaos commented Dec 21, 2019

Environment

  • Windows 10 Home version 1909
  • Deno version 0.27.0

Steps to Reproduce

  1. Create a file test.js
// test.js
console.clear();
console.log('Hello World')
  1. Run deno test.js

Observed Behaivor

Program exits, Hello World is not visible in the terminal. I see a flash where it looks like it may be printed but then cleared a split second later.

Expected Behaivor

Because console.log is invoked after console.clear, I would expect the terminal to be cleared and then print Hello World, so that the text is visible after the program exits. I executed an equivalent test in Node, FF console, and Chrome console and got this behavior (except that the browsers print the message Console was cleared.; I'm thankful deno doesn't).

Notes

I believe this may be an issue with synchronicity because I can "fix" it by doing...

console.clear();
setTimeout(() => console.log('Hello World'), 100)
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

Successfully merging a pull request may close this issue.

1 participant