Skip to content

Async output in repl is showing after the prompt #35895

@vsemozhetbyt

Description

@vsemozhetbyt
  • Version: 14.15.0, 15.0.1
  • Platform: Windows 10 x64
  • Subsystem: repl
> throw new Error();
Uncaught Error
> // prompt is shown
> 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 prompt 
> new Promise((rs, rj) => { rj(); }).catch(console.log)
Promise { <pending> }
> undefined
// no NEW prompt 
> new Promise((rs, rj) => { rj(); }).catch(()=>{})
Promise { <pending> }
> // prompt is shown
> new Promise((rs, rj) => { rs(42); }).then(console.log)
Promise { <pending> }
> 42
// no NEW prompt here

Metadata

Metadata

Assignees

No one assigned

    Labels

    replIssues and PRs related to the REPL subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions