Repository navigation
Async output in repl is showing after the prompt #35895
Description
- Version: 14.15.0, 15.0.1
- Platform: Windows 10 x64
- Subsystem: repl
Activity
- changed the title
[-]Rejected promise prevents repl from showing prompt if somithing is logged before[/-][+]Async output in repl is showing after the prompt[/+]on Oct 31, 2020 - addedreplIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
on Dec 18, 2020 Ok i'm testing the scenario from master now. The scenario mentioned:
> new Promise((rs, rj) => { rj(); }) Promise { <rejected> undefined } > (node:4108) UnhandledPromiseRejectionWarning: undefined (node:4108) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 7) // no NEW promptis now crashing the repl altogether.
When I try it in 15.11.0 or in today's nightly or canary, I get the same output, now it seems OK:
> new Promise((rs, rj) => { rj(); }) Promise { <rejected> undefined } > Uncaught undefined > // Prompt is here!
@vsemozhetbyt Yes the other issues still seems to be present.
The reason the Uncaught part now works is that it does not cause a deprecation warning anymore due to the specified unhandled rejection warning.
It is tricky to fix this, since we write on the stream directly. We do not use the regular input methods for e.g., warnings. And what should happen for async writes on the stream? Should they be marked specially? It is currently intermixed with the line input and visualized as input. That's incorrect but difficult to fix, especially in a way that is easy to understand for users.
This issue has been stale for a long time. Also, it focuses on an old, no longer supported version of Node. I'll close it for those reasons. If needed, feel free to reopen.