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

375, race condition error, while counting files #400

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

trapvpack
Copy link
Contributor

closes #375
@yegor256 take a look please

return curr;
} catch (err) {
if (err.code === 'ENOENT') {
console.info(`Directory or file is not found: ${dir}`);
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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': {}}); // Пустая директория
Copy link
Member

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'));

Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

race condition error, while counting files
2 participants