Skip to content

Clobber mode issue #64

@redgecombe

Description

@redgecombe

There seems to be an issue copying a directory over another directory using clobber mode. I am finding that intermittently the completion callback is never triggered.

I did a little digging and saw that the "running" count becomes negative in my case.

I think the issue is in the onFile function here:

      if(clobber) {
        rmFile(target, function () {
          copyFile(file, target);
        });
      }
      if (modified) {
        var stat = dereference ? fs.stat : fs.lstat;
        stat(target, function(err, stats) {
            //if souce modified time greater to target modified time copy file
            if (file.mtime.getTime()>stats.mtime.getTime())
                copyFile(file, target);
            else return cb();
        });
      }

If clobber is true, there can be two calls to copyFile, eventually causing two calls to cb, resulting in the started/finished/running counts getting out of sync. I think this is related to this change:
85cd50a

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions