Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: fix type error for _refreshLine #52133

Merged
merged 1 commit into from
Mar 21, 2024

Conversation

JacksonTian
Copy link
Contributor

@JacksonTian JacksonTian commented Mar 18, 2024

When press tab, but don't hit any completions, the interface throws type error.

node:internal/readline/interface:687
      this._refreshLine();
           ^

TypeError: this._refreshLine is not a function
    at [_tabCompleter] (node:internal/readline/interface:687:12)
    at [_tabComplete] (node:internal/readline/interface:660:24)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.11.1

The reproduce steps:

  1. The code:
import readline from "readline/promises";

const completions = '.set_a .set_b .help'.split(' ');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    completer: (line) => {
        const hits = completions.filter((c) => c.startsWith(line));
        // Show all completions if none found
        return [hits.length ? hits : completions, line];
    }
});

const answer = await rl.question('What is your query: > ');
  1. Run it with node. Type in hh, then press tab.
  2. Gets type error.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module. labels Mar 18, 2024
@BridgeAR BridgeAR added the request-ci Add this label to start a Jenkins CI on a PR. label Mar 18, 2024
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Mar 18, 2024
@nodejs-github-bot
Copy link
Collaborator

@debadree25 debadree25 added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 19, 2024
@H4ad H4ad added the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 21, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Mar 21, 2024
@nodejs-github-bot nodejs-github-bot merged commit 0a252c2 into nodejs:main Mar 21, 2024
66 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 0a252c2

rdw-msft pushed a commit to rdw-msft/node that referenced this pull request Mar 26, 2024
PR-URL: nodejs#52133
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request May 2, 2024
PR-URL: #52133
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
marco-ippolito pushed a commit that referenced this pull request May 3, 2024
PR-URL: #52133
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. needs-ci PRs that need a full CI run. readline Issues and PRs related to the built-in readline module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants