375, race condition error, while counting files#400
Open
trapvpack wants to merge 2 commits intoobjectionary:masterfrom
Open
375, race condition error, while counting files#400trapvpack wants to merge 2 commits intoobjectionary:masterfrom
trapvpack wants to merge 2 commits intoobjectionary:masterfrom
Conversation
yegor256
reviewed
Nov 29, 2024
| return curr; | ||
| } catch (err) { | ||
| if (err.code === 'ENOENT') { | ||
| console.info(`Directory or file is not found: ${dir}`); |
Member
There was a problem hiding this comment.
@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.
Contributor
Author
There was a problem hiding this comment.
@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?
Member
There was a problem hiding this comment.
@trapvpack are you sure the tests you created reproduce the problem? Do you see the error when you run them (without your fix)?
yegor256
reviewed
Dec 7, 2024
| assert.strictEqual(result, 7, `Expected to find 5 files, but found ${result}`); | ||
| }); | ||
| it('returns 0 for an empty directory', () => { | ||
| mock({'emptyDir': {}}); // Пустая директория |
yegor256
reviewed
Dec 7, 2024
| 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')); | ||
|
|
Member
There was a problem hiding this comment.
@trapvpack it's better not to use empty lines inside code blocks: https://www.yegor256.com/2014/11/03/empty-line-code-smell.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #375
@yegor256 take a look please