Merge pull request #386 from twitter/tmp-dir-cleanup

Use unsafeCleanup to clear temporary dirs, closes #345.
This commit is contained in:
André Cruz
2013-04-11 16:50:58 -07:00
2 changed files with 10 additions and 3 deletions

View File

@@ -431,7 +431,11 @@ Package.prototype.download = function () {
src = url.parse(this.assetUrl);
}
tmp.dir({ prefix: 'bower-' + this.name + '-', mode: parseInt('0777', 8) & (~process.umask()) }, function (err, tmpPath) {
tmp.dir({
prefix: 'bower-' + this.name + '-',
mode: parseInt('0777', 8) & (~process.umask()),
unsafeCleanup: true
}, function (err, tmpPath) {
if (err) return this.emit('error', err);
var req = src.protocol === 'https:' ? https : http;
@@ -514,7 +518,10 @@ Package.prototype.extract = function () {
Package.prototype.copy = function () {
template('action', { name: 'copying', shizzle: this.path }).on('data', this.emit.bind(this, 'data'));
tmp.dir({ prefix: 'bower-' + this.name + '-' }, function (err, tmpPath) {
tmp.dir({
prefix: 'bower-' + this.name + '-',
unsafeCleanup: true
}, function (err, tmpPath) {
if (err) return this.emit('error', err);
fs.stat(this.path, function (err, stats) {

View File

@@ -15,7 +15,7 @@
"node": ">=0.8.0"
},
"dependencies": {
"tmp": "~0.0.16",
"tmp": "~0.0.17",
"glob": "~3.1.14",
"nopt": "~2.0.0",
"archy": "~0.0.2",