Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (rp.indexOf(opts.gently) !== 0) {
var er = new Error("Refusing to delete: "+p+" not in "+opts.gently)
er.errno = require("constants").EEXIST
er.code = "EEXIST"
er.path = p
throw er
}
}
if (!stat.isDirectory()) return fs2.unlink(p).wait()
var rimrafs = fs2.readdir(p).wait().map(function (file) {
return rimraf(path.join(p, file), opts)
})
Future.wait(rimrafs)
fs2.rmdir(p).wait()
timeout = 0
return
} catch (er) {
if (er.message.match(/^EMFILE/) && timeout < EMFILE_MAX) {
timer(timeout++).wait()
} else if (er.message.match(/^EBUSY/)
&& busyTries < opt.maxBusyTries) {
timer(++busyTries * 100).wait()
} else if (er.message.match(/^ENOENT/)) {
// already gone
return
} else {
throw er
}
if (rp.indexOf(opts.gently) !== 0) {
var er = new Error("Refusing to delete: "+p+" not in "+opts.gently)
er.errno = require("constants").EEXIST
er.code = "EEXIST"
er.path = p
throw er
}
}
if (!stat.isDirectory()) return fs2.unlink(p).wait()
var rimrafs = fs2.readdir(p).wait().map(function (file) {
return rimraf(path.join(p, file), opts)
})
Future.wait(rimrafs)
fs2.rmdir(p).wait()
timeout = 0
return
} catch (er) {
if (er.message.match(/^EMFILE/) && timeout < EMFILE_MAX) {
timer(timeout++).wait()
} else if (er.message.match(/^EBUSY/)
&& busyTries < opt.maxBusyTries) {
timer(++busyTries * 100).wait()
} else if (er.message.match(/^ENOENT/)) {
// already gone
return
} else {
throw er
}
if (rp.indexOf(opts.gently) !== 0) {
var er = new Error("Refusing to delete: "+p+" not in "+opts.gently)
er.errno = require("constants").EEXIST
er.code = "EEXIST"
er.path = p
throw er
}
}
if (!stat.isDirectory()) return fs2.unlink(p).wait()
var rimrafs = fs2.readdir(p).wait().map(function (file) {
return rimraf(path.join(p, file), opts)
})
Future.wait(rimrafs)
fs2.rmdir(p).wait()
timeout = 0
return
} catch (er) {
if (er.message.match(/^EMFILE/) && timeout < EMFILE_MAX) {
timer(timeout++).wait()
} else if (er.message.match(/^EBUSY/)
&& busyTries < opt.maxBusyTries) {
timer(++busyTries * 100).wait()
} else if (er.message.match(/^ENOENT/)) {
// already gone
return
} else {
throw er
}
exports.run = function(fn, context) {
if(_connections.length === 0) {
Future.wait(context.hosts.map(function(host) {
var _context = extend({}, context);
_context.remote = host;
return connect(_context);
}));
}
Future.wait(_connections.map(function(connection) {
return execute(connection, fn);
}));
};
new Fiber(function() {
results.push(self.exec(command, options));
return future.return();
}).run();
return future;
};
var tasks = [];
self._context.hosts.forEach(function(remote) {
tasks.push(task(remote));
});
Future.wait(tasks);
fs.unlinkSync(tmpFile);
return results;
};
var task = function() {
var transport = new Shell(_context);
new Fiber(function() {
fn(transport);
return future.return();
}).run();
return future;
};
var t = process.hrtime();
logger.info('Executing local task');
Future.wait(task());
logger.info('Local task finished after ' + prettyTime(process.hrtime(t)));
};
flight.status.executionTime = process.hrtime(t);
this.status.executionTime = flight.status.executionTime;
return future.return();
}
}.bind(this)).run();
return future;
}.bind(this);
var tasks = [];
for(var i=0, len=this.hosts.length; i < len; i++) {
tasks.push(task(this.hosts[i]));
}
Future.wait(tasks);
return this.status;
};