Skip to content

Emit a warning if process exits with unsettled modules? #39665

Closed
@targos

Description

@targos

Here's a simple ES module with top-level await:

console.log('before');

await new Promise(() => {});

console.log('after');

Executing it only prints before and then exits with code 13.

I don't know where the exit code is set, but it seems that we actually detect that the promise representing the module's execution never settles.
Could we emit/print a warning when it happens? Ideally it could contain the path to the problematic module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    errorsIssues and PRs related to JavaScript errors originated in Node.js core.esmIssues and PRs related to the ECMAScript Modules implementation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions