-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
Description
- Version:v12.13.0
- Platform:Linux myuser 4.15.0-74-generic Proposal: Introduce CI builds to GitHub PR process #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem:
readline.createInterface
asyncIterator
What steps will reproduce the bug?
if you perform something like
https://github.com/nodejs/node/blob/2a7432dadec08bbe7063d84f1aa4a6396807305c/test/parallel/test-readline-async-iterators.js
async function testSimple() {
for (const fileContent of testContents) {
fs.writeFileSync(filename, fileContent);
const readable = fs.createReadStream(filename);
const rli = readline.createInterface({
input: readable,
crlfDelay: Infinity
});
const iteratedLines = [];
for await (const k of rli) {
iteratedLines.push(k);
}
const expectedLines = fileContent.split('\n');
if (expectedLines[expectedLines.length - 1] === '') {
expectedLines.pop();
}
assert.deepStrictEqual(iteratedLines, expectedLines);
assert.strictEqual(iteratedLines.join(''), fileContent.replace(/\n/gm, ''));
}
}
If you add some kind of await xxx() between creating the interface and iterating, the iterator will miss lines. In my case I input 100k lines from a file, then output those same lines to a new file. several thousand lines will go missing.
How often does it reproduce? Is there a required condition?
100%
Need to add some await async between creating the interface and using for await
What is the expected behavior?
not to miss iterations
What do you see instead?
Additional information
govindrai
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.readlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.