You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Callback called multiple times, but not always #111
Not sure how to replicate; I am running a test for another project where I'm using ncp to duplicate a file directory (so the original sample isn't modified for the test). I am getting an error on some (but not all) of my tests that "Done is being called multiple times", and I can verify that behavior by passing my own function in the callback and logging every time it's called. It appears to be just happening on one of the project directories that I'm copying.
In any case, there's no instance ever that a callback should be called more than once, so this is a bug.
Reacted by zhang, makiJS, Eric Swanson, i-am-lioness and mayanqiong
I also noticed strange behavior...
seems like longer copy tasks callbacks get called more times (instead of faster copy actions) BUT only when I run it for second time - so that files already exists.
Look at the results, numbers are assigned before staring any copy actions:
C:\bin\commands\backup\backuper>node index.js
STARTED 1||hosts
STARTED 2||.dotvm
STARTED 3||.homestead
STARTED 4||.ssh
STARTED 5||.vagrant.d
STARTED 6||.VirtualBox
STARTED 7||Desktop
STARTED 8||Scanned Documents
STARTED 9||Downloads
STARTED 10||Pictures
STARTED 11||Videos
STARTED 12||.gitconfig
FINISHED 1||hosts
FINISHED 12||.gitconfig
FINISHED 11||Videos
FINISHED 8||Scanned Documents
FINISHED 7||Desktop
FINISHED 6||.VirtualBox
FINISHED 4||.ssh
FINISHED 2||.dotvm
FINISHED 3||.homestead
FINISHED 9||Downloads
FINISHED 10||Pictures
FINISHED 5||.vagrant.d
C:\bin\commands\backup\backuper>node index.js
STARTED 1||hosts
STARTED 2||.dotvm
STARTED 3||.homestead
STARTED 4||.ssh
STARTED 5||.vagrant.d
STARTED 6||.VirtualBox
STARTED 7||Desktop
STARTED 8||Scanned Documents
STARTED 9||Downloads
STARTED 10||Pictures
STARTED 11||Videos
STARTED 12||.gitconfig
FINISHED 1||hosts
FINISHED 12||.gitconfig
FINISHED 8||Scanned Documents
FINISHED 9||Downloads
FINISHED 11||Videos
FINISHED 3||.homestead
FINISHED 2||.dotvm
FINISHED 5||.vagrant.d
FINISHED 5||.vagrant.d
FINISHED 5||.vagrant.d
FINISHED 5||.vagrant.d
FINISHED 5||.vagrant.d
FINISHED 5||.vagrant.d
Activity
jurosh commentedon Nov 27, 2016
I also noticed strange behavior...
seems like longer copy tasks callbacks get called more times (instead of faster copy actions) BUT only when I run it for second time - so that files already exists.
Look at the results, numbers are assigned before staring any copy actions:
And ugly debug code:
ericis commentedon Oct 24, 2017
Same issue. Outstanding for a year?
The Typescript code below ends up logging
[DefaultFileReader] copyDirectoryTree()only once, but[DefaultFileReader] ncp callbackis logged 5 times.ericis commentedon Oct 24, 2017
Switching to
fs-extracopycommand worked for me.https://github.com/jprichardson/node-fs-extra/blob/HEAD/docs/copy.md