davglass / cpr

Nodejs cp -R
Other
79 stars 80 forks source link

Fixing write race condition #57

Closed PlutoMatt closed 6 years ago

PlutoMatt commented 6 years ago

Fixing a race condition that can occur when copying files. Previously the finished callback was called when the file read stream was done reading, but potentially before the write stream was done.

catto commented 6 years ago

Same here. When I try to copy files, sometimes it fails with an error of fs.stat when confirm flag is true even if all files are copied successfully. Possibly it occurs by calling the finished callback before creating toFiles.

davglass commented 6 years ago

Published in cpr@3.0.0