Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-06-05 21:17:34 +0300
committerKat Marchán <kzm@sykosomatic.org>2017-06-06 00:20:51 +0300
commit6e12a5cc022cb5a157a37df7283b6d7b3d49bdab (patch)
treebf48d3b7bf1e1ad936936e113e72b594a55cd6f0 /node_modules/cacache/lib/util/move-file.js
parent0b9fc56a8e451003a613f75b166cfacc49e2d9a9 (diff)
deps: bump cacache, pacote, ssri, readable-stream, safe-buffer
Diffstat (limited to 'node_modules/cacache/lib/util/move-file.js')
-rw-r--r--node_modules/cacache/lib/util/move-file.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/node_modules/cacache/lib/util/move-file.js b/node_modules/cacache/lib/util/move-file.js
index 422c8294e..e12e98188 100644
--- a/node_modules/cacache/lib/util/move-file.js
+++ b/node_modules/cacache/lib/util/move-file.js
@@ -2,6 +2,8 @@
const fs = require('graceful-fs')
const BB = require('bluebird')
+const chmod = BB.promisify(fs.chmod)
+const unlink = BB.promisify(fs.unlink)
let move
let pinflight
@@ -27,8 +29,11 @@ function moveFile (src, dest) {
return cb(err)
}
}
- return fs.unlink(src, cb)
+ return cb()
})
+ }).then(() => {
+ // content should never change for any reason, so make it read-only
+ return BB.join(unlink(src), process.platform !== 'win32' && chmod(dest, '0444'))
}).catch(err => {
if (process.platform !== 'win32') {
throw err