Skip to content

readline/promises question results in unsettled top-level await when reading script from stdin #60344

Description

@mb21

Version

v25.0.0 (also reproduced in v24.9.0)

Platform

Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:52 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T8112 arm64

Subsystem

node:readline/promises

What steps will reproduce the bug?

Place this in test.js:

import { stdin, stdout } from "node:process";
import { createInterface } from "node:readline/promises";

const rl = createInterface({ input: stdin, output: stdout });
const answer = await rl.question("hi\n");
console.log(answer);

and run it with:

cat test.js | node

the above is important. node test.js works fine.

How often does it reproduce? Is there a required condition?

Always.

What is the expected behavior? Why is that the expected behavior?

Program does not terminate.

What do you see instead?

Program terminates with exit code 13 and prints:

hi
Warning: Detected unsettled top-level await at file:///Users/me/test/[eval1]:5
const answer = await rl.question("hi");

Additional information

This seems related, but in my case I don't hit Ctrl-C: #53497

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions