AvianFlu / ncp

Asynchronous recursive file copying with Node.js.
MIT License
680 stars 103 forks source link

Async Callback Buggy #71

Open DavidSouther opened 9 years ago

DavidSouther commented 9 years ago

Starting with grunt-docco, we noticed a directory copy sometimes failed (https://github.com/DavidSouther/grunt-docco/issues/40). We tracked that down to node-fs-extra, where @malinges opened https://github.com/jprichardson/node-fs-extra/issues/98; I duplicated that error using ncp directly and am opening this here.

% git clone https://gist.github.com/DavidSouther/77db8d2ce83c98521082
% cd 77db8d2ce83c98521082
% npm install
% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }
done: { '0': null }

% node copytest1.js
done: { '0': null }
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }

% node copytest1.js
done: { '0': null }
done: { '0': null }

% node copytest2.js
done: { '0': null }

% node copytest2.js

% node copytest2.js

% node copytest2.js

% node copytest2.js

%

We expect either of these files to always output exactly one done event with no arguments.

Possibly related to #51, #66?

adam-lynch commented 9 years ago

:+1:

DavidSouther commented 9 years ago

This only occurs when the target directory is not empty.

DavidSouther commented 9 years ago

There's a fix for this in https://github.com/jprichardson/node-fs-extra/issues/98#issuecomment-72717152 at https://github.com/jprichardson/node-fs-extra/commit/35345a330fedfd2aaab54471d1db9cbcdc087a94 - but lack of dev interest on the issues board is frustrating.