Skip to content

Commit

Permalink
Merge pull request #144 from Galaxy-Semi/master
Browse files Browse the repository at this point in the history
Fix# 143 - EPERM error in Windows
  • Loading branch information
Matt Hernandez committed Sep 9, 2015
2 parents 99dc8d1 + 5e290b9 commit 2ca819d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/update-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ module.exports = function (options, done) {
Hoek.merge(packageContents, options.json || {});

//
// The generated package.json is read-only, but removing it prior to writing
// will allow updates.
// Change the file permissions so we can over-write the package. Then we'll write the package
// and then change the file permissions back to read-only.
//
Fs.unlinkSync(packagePath);
Fs.chmodSync(packagePath, '0644') ;
Fs.writeFile(packagePath, JSON.stringify(packageContents, null, 2), done);
};
4 changes: 2 additions & 2 deletions test/update-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('update-package', function () {
before(function (done) {
fsStub.existsSync = Sinon.stub().returns(true);
fsStub.readFileSync = Sinon.stub().returns('{}');
fsStub.unlinkSync = Sinon.stub();
fsStub.chmodSync = Sinon.stub();
fsStub.writeFile = Sinon.stub().yields(null);
done();
});
Expand All @@ -62,7 +62,7 @@ describe('update-package', function () {
before(function (done) {
fsStub.existsSync = Sinon.stub().returns(true);
fsStub.readFileSync = Sinon.stub().returns('{}');
fsStub.unlinkSync = Sinon.stub();
fsStub.chmodSync = Sinon.stub();
fsStub.writeFile = Sinon.stub().yields(null);
done();
});
Expand Down

0 comments on commit 2ca819d

Please sign in to comment.