-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Windows] fs.copy error with {preserveTimestamps} #478
Comments
@laggingreflex Are you on 32-bit windows? |
64-bit, Window 10 |
Expanding on the fs.open(path, 'r+', (err, fd) => { // <<<
if (err) return callback(err)
fs.futimes(fd, atime, mtime, futimesErr => {
fs.close(fd, closeErr => {
if (callback) callback(futimesErr || closeErr)
})
})
}) If I replace it with just this it fixes the issue for me: fs.utimes(path, atime, mtime, futimesErr => {
if (callback) callback(futimesErr)
}) But the tests still don't pass. Using |
Also interesting that the error doesn't occur when running the tests, but they still fail. The tests fail with the same result:
Is this due to that millisecond precision? And does Windows actually support millisecond precision? |
I found out in my case the issue was that the destination file was set to "read only". I think these might be two separate issues.
* edit: it actually creates the file with the said mode var writeStream = fs.createWriteStream(target, { mode: file.mode }) |
#479 fixes my issue. |
v5 significantly rewrote |
fs.copy(src, dest, {preserveTimestamps: true})
fails on Windows with error:The error occurs in this part of the code:
Edit: Correction :
https://github.com/jprichardson/node-fs-extra/blame/master/lib/copy/ncp.js#L113https://github.com/jprichardson/node-fs-extra/blame/master/lib/copy/ncp.js#L116
I forked the library and these 2 tests are also failing:
The text was updated successfully, but these errors were encountered: