-
Notifications
You must be signed in to change notification settings - Fork 22
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
375, race condition error, while counting files #400
base: master
Are you sure you want to change the base?
Conversation
return curr; | ||
} catch (err) { | ||
if (err.code === 'ENOENT') { | ||
console.info(`Directory or file is not found: ${dir}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trapvpack exception swallowing doesn't look like a solution to me. Instead, let's try to find the root cause of the problem and fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yegor256 After looking through mvnw.js
, I could only trace a possible problem with calling start
before closing spawn
, but I'm not at all sure about this. The questions are:
- Do you have any ideas about what we should pay attention to?
- Could this be a bug outside of
mvnw.js
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trapvpack are you sure the tests you created reproduce the problem? Do you see the error when you run them (without your fix)?
assert.strictEqual(result, 7, `Expected to find 5 files, but found ${result}`); | ||
}); | ||
it('returns 0 for an empty directory', () => { | ||
mock({'emptyDir': {}}); // Пустая директория |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trapvpack please, use ONLY English in comments
it('handles files being deleted during count', async () => { | ||
await fs.promises.unlink(path.join('mainDir', 'testDir', 'folder1', 'file2.txt')); | ||
await fs.promises.unlink(path.join('mainDir', 'flatDir', 'file1.txt')); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@trapvpack it's better not to use empty lines inside code blocks: https://www.yegor256.com/2014/11/03/empty-line-code-smell.html
closes #375
@yegor256 take a look please