-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Improved workarounds for win32 #119
Closed
Closed
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
14bb35a
Stat from file to make sure it was renamed
mekwall ecbebd8
Resolve if source and destination is the same size
mekwall 92dd004
Except rename to not return an error
mekwall c2831ea
Unlink source if it's the same as destination
mekwall 5d39057
Do not unlink file
mekwall 2528177
Add fs.renameSync for win32
mekwall 4882f5d
Remove extraneous line
mekwall 6e491f5
Improve stat compare between src and dest
mekwall 4ddb118
Ignore ENOENT for src on retry
mekwall f7f1d95
Wait until dest exist and src does not
mekwall b564fd9
Revamped rename tests
mekwall 3c4e270
Remove sneaky arrow functions
mekwall 625f52b
Updated comments and formatting
mekwall 1b41578
Assume rename was successful if source no longer exists
mekwall 641fa52
Make sure both statFrom and statTo are set
mekwall 516fa6c
Add additional comment about size/ctime comparison
mekwall 78f7a5b
Unlink target it if exists
mekwall a10aa57
Add test for renaming dirs
mekwall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,72 @@ | ||
process.env.GRACEFUL_FS_PLATFORM = 'win32' | ||
|
||
var fs = require('fs') | ||
fs.rename = function (a, b, cb) { | ||
setTimeout(function () { | ||
var er = new Error('EPERM blerg') | ||
er.code = 'EPERM' | ||
cb(er) | ||
}) | ||
} | ||
|
||
var gfs = require('../') | ||
var t = require('tap') | ||
var a = __dirname + '/a' | ||
var b = __dirname + '/b' | ||
var tmpDir = __dirname + '/tmp' | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly the worst hack ever, but it seems to be the only real way to solve inconsistent behavior on Windows where the destination and source can exist at the same time.