kopia lustrzana https://github.com/c9/core
fix maxBuffer exceeded error when deleting folder owned by root
rodzic
96a57484c2
commit
91f98d3aee
|
@ -429,8 +429,17 @@ module.exports = function setup(fsOptions) {
|
|||
var meta = {};
|
||||
resolvePath(path, options, function (err, realpath) {
|
||||
if (err) return callback(err);
|
||||
fn(realpath, function (err) {
|
||||
if (err) return callback(err);
|
||||
fn(realpath, function done(err) {
|
||||
if (err) {
|
||||
if (err.code == "ENOENT") {
|
||||
return fs.exists(realpath, function(exists) {
|
||||
if (exists) err.code = "EACCES";
|
||||
callback(err);
|
||||
});
|
||||
} else {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove metadata
|
||||
resolvePath(WSMETAPATH + path, options, function (err, realpath) {
|
||||
|
@ -1003,7 +1012,17 @@ module.exports = function setup(fsOptions) {
|
|||
function rmdir(path, options, callback) {
|
||||
if (options.recursive) {
|
||||
remove(path, function(path, callback) {
|
||||
execFile("rm", {args: ["-rf", path]}, callback);
|
||||
spawn("rm", {args: ["-rf", path], stdio: 'ignore'}, function(err, child) {
|
||||
if (err) return callback(err);
|
||||
child.process.on("close", function(code) {
|
||||
if (code) {
|
||||
var err = new Error("Permission denied.");
|
||||
err.code = "EACCES";
|
||||
return callback(err);
|
||||
}
|
||||
callback();
|
||||
});
|
||||
});
|
||||
}, options, callback);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -746,7 +746,7 @@ define(function(require, exports, module) {
|
|||
} else if (node.status == "loading") {
|
||||
plugin.on("readdir", function listener(e) {
|
||||
if (e.path == subPath) {
|
||||
plugin.on("readdir", listener);
|
||||
plugin.off("readdir", listener);
|
||||
recur();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -462,8 +462,9 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
|
|||
|
||||
fs.writeFile(before, text, function(err) {
|
||||
expect(fsCache.findNode(before), "start").to.exist;
|
||||
expect(fsCache.findNode(after), "start").to.not.exist;
|
||||
fs.rename(before, after, function() {
|
||||
expect(fsCache.findNode(after), "afer").to.exist;
|
||||
expect(fsCache.findNode(after), "after").to.exist;
|
||||
expect(fsCache.findNode(before), "before").to.not.exist;
|
||||
fs.rmfile(after, function(){
|
||||
fsCache.off("update", c1);
|
||||
|
@ -486,6 +487,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
|
|||
fsCache.on("update", c1);
|
||||
|
||||
fs.writeFile(before, text, function(err) {
|
||||
expect(err).to.not.ok;
|
||||
expect(fsCache.findNode(before), "start").to.exist;
|
||||
|
||||
fs.rename(before, after, function() {
|
||||
|
@ -500,11 +502,10 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
|
|||
throw new Error("Wrong Event Count: "
|
||||
+ count + " of 2");
|
||||
});
|
||||
// Disabled: test fails only on CI server...
|
||||
});
|
||||
});
|
||||
});
|
||||
it.skip("should recursively update the nodes in cache when a dir is renamed", function(done) {
|
||||
it("should recursively update the nodes in cache when a dir is renamed", function(done) {
|
||||
fs.rmdir("/rdir", {recursive:true}, function(){
|
||||
fs.copy("/dir", "/dir2", {recursive: true}, function(err) {
|
||||
if (err) throw err.message;
|
||||
|
@ -535,7 +536,7 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root", "events"],
|
|||
+ count + " of 3");
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -18,12 +18,6 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"],
|
|||
"plugins/c9.vfs.client/endpoint",
|
||||
"plugins/c9.ide.auth/auth",
|
||||
|
||||
//Mock Plugins
|
||||
{
|
||||
consumes: ["Plugin"],
|
||||
provides: ["auth.bootstrap", "info", "dialog.error"],
|
||||
setup: expect.html.mocked
|
||||
},
|
||||
{
|
||||
consumes: ["fs"],
|
||||
provides: [],
|
||||
|
@ -285,6 +279,8 @@ require(["lib/architect/architect", "lib/chai/chai", "/vfs-root"],
|
|||
expect(exists).ok;
|
||||
|
||||
fs.rmdir(vpath, {}, function(err, meta) {
|
||||
if (err.code == "EACCES") // node sends EACCES on windows
|
||||
err.code = "ENOTDIR";
|
||||
expect(err).property("code").equal("ENOTDIR");
|
||||
done();
|
||||
});
|
||||
|
|
Ładowanie…
Reference in New Issue