Skip to content

Conversation

@jfremy
Copy link

@jfremy jfremy commented Jan 16, 2015

The logic when overwriting a file seems wrong. If you look at the code path, if clobber is true and modified is false, then there will be a systematic call to cb in the last else statement of onFile.

I've seen the bug in an app of mine that uses ncp but it was hard to trigger and all your unit tests passed.
So I added an additional sanity check in the cb handler that verifies that running is postive or zero and that finished is lower or equal to started.
After doing that, your tests would nearly all fails because of multiple calls to done => which means that one of those invalid situations happened while with the fix in inFile it does work.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good idea, this will help catch other mis-matches

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.

2 participants