REPL spamming and stuck when Promise.any([]). is typedΒ #65581
Description
Activity
This one looks specific to v22. There the completer picks the receiver out with a regex (
simpleExpressionREinlib/repl.js) and evaluates it, soPromise.any([])really runs while you type. Every run creates a new rejected promise, printing the unhandled rejection redraws the line, and the redraw runs completion again.v24 replaced that regex with an AST walk that refuses to evaluate call expressions, in #59774. You can see the difference without a terminal:
const repl = require('node:repl'); const { PassThrough } = require('node:stream'); let calls = 0; globalThis.mark = () => { calls++; return {}; }; const out = new PassThrough(); out.resume(); repl.start({ input: new PassThrough(), output: out, terminal: false, useGlobal: true }) .complete('mark().', () => console.log(process.version, calls));
v22.23.2 prints
1, v24.19.0 and v26.7.0 print0.That PR is labelled
backport-requested-v22.xand hasn't landed onv22.x-staging, so v22 keeps the old code path for now. Whether it gets backported is a release team call.The
import("").case in #64523 is a separate path, fixed on main by the semver-major #64034, so v24 and v26 still loop on that one.Reacted by Aviv Keller- addedv22.xIssues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.
on Sep 8, 2026 - addedreplIssues and PRs related to the REPL subsystem.Issues and PRs related to the REPL subsystem.
on Sep 25, 2026
Version
v22.23.2
Platform
Subsystem
No response
What steps will reproduce the bug?
nodePromise.any([])Promise.any([]).How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Don't print same message infinitely
What do you see instead?
node-repl-boom.mov
Additional information
No response