prettydiff / biddle

Self-hosted application distribution
MIT License
66 stars 4 forks source link

copy is sporadically failing on both posix and windows #5

Closed prettydiff closed 7 years ago

prettydiff commented 7 years ago

On posix copy test fails about 1 time out of 10. It seems the biddle code is correct as this is a shallow wrapper around a child process. I suspect, though not validated, the problem is something between an issued a posix command (as a child process) and a verification that follows to quickly after.

On windows this problem occurs more frequently and is typically experienced from the publish test when running biddle test.

Copy command for posix:

cp -R targetPath destinationPath

Copy command for Windows:

xcopy "targetPath" "desintationPath" /E /Q /G /H /Y /J /I
prettydiff commented 7 years ago

Writing my own Node recursive copy solution following this plan:

  1. stat the target
  2. if target is file then read the file as a stream and write as stream to destination
  3. if target is directory then make directory in destination location and run fs.readdir to get child items and repeat step 1. on each child item
  4. if target is a symlink replicate the symlink into the destination location with fs.readlink

I have solved a similar problem before in Pretty Diff and so will solve it here.

prettydiff commented 7 years ago

Fixed.