fix: handle race condition in count function when files are deleted during counting (#375)#576
Conversation
|
@karishka1222 Hey team! 🚀 Let's align our branch naming conventions for better project management. Instead of " |
|
@yegor256 Hello, can you check this pull request, please |
|
@karishka1222 Thanks for your contribution, we appreciate it! Before we can merge this pull request, we need to see all CI workflows pass without errors. We can't merge the pull request into the master branch unless all workflows are green. Try to fix them, also paying attention to code style issues. |
|
@yegor256 Hello! I've fixed pipeline |
test/test_mvnw.js
Outdated
| }); | ||
| }); | ||
| it('handles race condition when files are deleted during counting', (done) => { | ||
| // Create a temporary directory for testing |
There was a problem hiding this comment.
@karishka1222 we don't appreciate comments inside method bodies and we don't use blank lines inside methods. You can use this prompt: https://github.com/yegor256/prompt
|
@yegor256 I fixed the code based on your comment. |
|
@maxonfjvipon could you please check this one |
|
@maxonfjvipon check, please |
Fix race condition when counting files (fixes #375)
Problem description
While running the
eoc compilecommand, the following error could occur:Error: ENOENT: no such file or directory, stat '.eoc/classes/EOorg/EOeolang/EOnan$EOtimes.class'This happened due to a race condition: one process deleted a file while another was trying to get its stats using
fs.statSyncin thecountfunction.What was done
countfunction insrc/mvnw.js. Now, if a file or directory is deleted during traversal, it is skipped and the counting continues.Why it matters
Now the file counting function works correctly even when files are being changed in parallel, preventing crashes and making the tool more reliable.
Related issue #375