Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #85 from twitter/chmod-tmp-dir

Chmod temp folder
  • Loading branch information...
commit a134950f858a5a9055bf6b80a4823ab9fdc11597 2 parents 5d9257d + ed13cab
@fat fat authored
Showing with 27 additions and 0 deletions.
  1. +2 −0  lib/core/package.js
  2. +25 −0 test/package.js
View
2  lib/core/package.js
@@ -232,6 +232,8 @@ Package.prototype.copy = function () {
tmp.dir(function (err, tmpPath) {
fs.stat(this.path, function (err, stats) {
if (err) return this.emit('error', err);
+ // copy file permission for directory
+ fs.chmodSync(tmpPath, stats.mode);
if (this.assetType) {
return fs.readFile(this.path, function (err, data) {
View
25 test/package.js
@@ -4,6 +4,7 @@ var fs = require('fs');
var nock = require('nock');
var _ = require('lodash');
var rimraf = require('rimraf');
+var async = require('async');
var config = require('../lib/core/config');
var Package = require('../lib/core/package');
@@ -149,4 +150,28 @@ describe('package', function () {
});
pkg.clone();
});
+
+ it('Should have accessible file permissions on temp folder', function (next) {
+ var pkg = new Package('jquery', 'git://github.com/maccman/package-jquery.git');
+ var cachePath;
+
+ pkg.on('cache', function() {
+ cachePath = pkg.path;
+ });
+ pkg.on('resolve', function () {
+ pkg.install();
+ });
+ pkg.on('install',function () {
+ async.map([pkg.localPath, cachePath], fs.stat, function (err, results) {
+ if (err) throw new Error(err);
+ assert.equal(results[0].mode, results[1].mode)
+ rimraf(config.directory, function(err){
+ next();
+ });
+ });
+ });
+
+ pkg.clone();
+ });
+
});
Please sign in to comment.
Something went wrong with that request. Please try again.