ncp icon indicating copy to clipboard operation
ncp copied to clipboard

Async Callback Buggy

Open DavidSouther opened this issue 10 years ago • 3 comments

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?

DavidSouther avatar Dec 13 '14 16:12 DavidSouther

:+1:

adam-lynch avatar Dec 19 '14 12:12 adam-lynch

This only occurs when the target directory is not empty.

DavidSouther avatar Dec 19 '14 15:12 DavidSouther

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.

DavidSouther avatar Feb 03 '15 20:02 DavidSouther