-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
REPL unblock event loop AND fix REPL setTimeout fire problems #1233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good - just one comment.
Also please split the commits into e5f204f and yours. |
2ce2f13
to
789da31
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
# Print after 0.1 second | ||
p.stdin.write( | ||
"setTimeout(() => console.log('HI'), 100)\n".encode("utf-8")) | ||
sleep(0.2) # Wait 0.2 second before proceed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be done with the existing input
method, without "special treatment" 😄, and avoid the repetition. I will make a separate PR.
- Allow async functions in REPL (denoland#1233) - Handle Location header relative URI (denoland#1240) - Add deno.readAll() (denoland#1234) - Add Process.output (denoland#1235) - Upgrade to TypeScript 3.2.1 - Upgrade crates: tokio 0.1.13, hyper 0.12.16, ring 0.13.5
Closes #1161 .
op_repl_readline
always blocking problem that breakssetTimeout
firesetTimeout
test/cc @hayd @cedric05
Also, though not fixed in this PR, there is one more issue I found that might need to be address later:
deno/src/resources.rs
Lines 335 to 345 in 89096c9
Since
let line = r.readline(&prompt)?;
is blocking, this might causeRESOURCE_TABLE.lock()
not released in REPL and blocks other resources reads and writes