-
Notifications
You must be signed in to change notification settings - Fork 772
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
with clobber true, copy and copySync behave differently if destination file is read only #183
Comments
Hi @jprichardson I'll submit a pull request to fix this (without the semi-colons ;) I've also added a test for it in copy-sync-file.test.js.
Tested on Ubuntu (see below). On Windows 7, there are 7 tests currently failing, so no change as long as this one passes. I will test OS X and FreeBSD next week. Result after the fix:
Result before the fix (Ubuntu):
|
Thank you, your help is much appreciated! If you submit a PR and it passes TravisCI/Appveyor, that'd be awesome :) |
I've worked out why the 7 tests are failing on windows. New issue opened #188. |
I'm about to submit a PR for this. It looks clean. Since I did the PR for #188 I just wanted your feedback on what I did to deal with this in my local repository. If ok, I'll submit a PR.
|
I'm not a Git expert by any means, but AFAICT, it looks good. |
hmm! Interesting. Node 0.12+ works but Node 0.10 fails. Nodejs must have changed its behavior. Any suggestions before I investigate?
|
Hmm. I know that I've had a number of issues in the past with trying to synchronously delete in Windows in my tests. Possibly related: isaacs/rimraf#72 (I posted in this thread awhile back). However this was a If possible, see if you can't dig around a bit. If it's an easy fix, let's do it. If it's difficult, I'm not opposed to dropping support for Node v0.10. But before, I'd at least like to know why. |
After some pain setting up a switchable between versions nodejs on Windows, the good news is a simple fix which works in 0.10.40 and 4.2.1. I will resubmit the PR soonish. I just added a chmodSync call. Fixed code:
|
copy succeeds because it will first do an fs.unlink() on the destination file (in ncp.js).
copySync fails.
To align the behaviour, in copy-file-sync.js change:
to
The text was updated successfully, but these errors were encountered: