Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Put 6 bytes of random in tmp folder name

Closes #3635
  • Loading branch information...
commit f4d31693e73a963574a88000580db1a716fe66f1 1 parent e300730
isaacs isaacs authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/npm.js
7 lib/npm.js
View
@@ -477,9 +477,14 @@ Object.defineProperty(npm, "cache",
})
var tmpFolder
+var crypto = require("crypto")
+var rand = crypto.randomBytes(6)
+ .toString("base64")
+ .replace(/\//g, '_')
+ .replace(/\+/, '-')
Object.defineProperty(npm, "tmp",
{ get : function () {
- if (!tmpFolder) tmpFolder = "npm-" + process.pid
+ if (!tmpFolder) tmpFolder = "npm-" + process.pid + "-" + rand
return path.resolve(npm.config.get("tmp"), tmpFolder)
}
, enumerable : true
Please sign in to comment.
Something went wrong with that request. Please try again.