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:
authorisaacs <i@izs.me>2010-12-03 03:54:42 +0300
committerisaacs <i@izs.me>2010-12-03 03:54:42 +0300
commit324d9a803b667658cd8f4c760cbb27f4bd951a20 (patch)
treebcf7d65eb180c17ff8569fad07b17105f580ae4f /lib/init.js
parentb8603ad685d62dd94ba52e1dab7c708da4950b8f (diff)
Fix #417. chdir() doesn't parallelize well.
Removed all the process.chdir() stuff that was a relic from a time when npm didn't do multiple different builds at the same time. Not sure how this bug stayed alive for so long. Maybe since it usually works if you just try again, and it's hard to deterministically reproduce. Special thanks to Charlie Robbins for bringing it to my attention.
Diffstat (limited to 'lib/init.js')
-rw-r--r--lib/init.js6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/init.js b/lib/init.js
index f7be0f138..fbbd93188 100644
--- a/lib/init.js
+++ b/lib/init.js
@@ -21,8 +21,6 @@ function init (args, cb) {
, ll = npm.config.get("loglevel")
npm.config.set("loglevel", "paused")
if (folder.charAt(0) !== "/") folder = path.join(process.cwd(), folder)
- try { process.chdir(folder) }
- catch (ex) { ex.message += ": "+folder ; return cb(ex) }
readJson(path.join(folder, "package.json"), function (er, data) {
if (er) data = {}
@@ -203,8 +201,8 @@ function defaultName (folder, data) {
function defaultVersion (folder, data, cb) {
if (data.version) return cb(null, data.version)
- process.chdir(folder)
- exec("git", ["describe", "--tags"], process.env, false, function (er, code, out) {
+ exec("git", ["describe", "--tags"], process.env, false, folder,
+ function (er, code, out) {
out = (out || "").trim()
if (semver.valid(out)) return cb(null, out)
return cb(null, "0.0.0")