diff options
author | isaacs <i@izs.me> | 2010-05-03 08:16:00 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-03 08:17:06 +0400 |
commit | 182bc73070db728a3f141122295ca0edcf467f81 (patch) | |
tree | 148957effeb2cfd4eb3e494edbaa31738278f30a /lib | |
parent | 90f8b8006f70a52c47837997a6dc9c31685643a3 (diff) |
Fix a bug with the fetchTarball function's callback
Diffstat (limited to 'lib')
-rw-r--r-- | lib/install.js | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/lib/install.js b/lib/install.js index bbf115368..7e0fcfc1b 100644 --- a/lib/install.js +++ b/lib/install.js @@ -57,7 +57,6 @@ function registryInstall (pkglist, cb) { , installReg = {} ;(function F (pkg) { if (!pkg) { - log("do the build", "install") installList = installList.map(function (i) { return path.join(npm.dir, i, "package") }) @@ -214,7 +213,7 @@ function fetchTarball (tarball, cb) { if (er) return cb(er) rm(target, function (er) { if (er) return cb(er) - cb(data) + cb(null, data) }) }) } @@ -227,13 +226,15 @@ function installLocalTarball (tarball, cb) { ( [mkdir, folder] , [unpackTar, tarball, folder] , function (er) { - if (er) return cb(er) - readJson(path.join(folder, "package.json"), function (er,data) { - chain - ( [moveIntoPlace, folder, data] - , [rm, folder] - , function (er) { return cb(er, data) } - ) + if (er) return cb(er) + readJson(path.join(folder, "package.json"), function (er,data) { + chain + ( [moveIntoPlace, folder, data] + , [log, data._id, "moved into place"] + , [rm, folder] + , [log, folder, "removed"] + , function (er) { return cb(er, data) } + ) }) } ) @@ -250,12 +251,9 @@ function moveIntoPlace (dir, data, cb) { return cb(new Error("Name or version not found in package info.")) } var target = path.join(npm.dir, data.name, data.version) - log("to: "+target+" from: "+dir, "moveIntoPlace") chain - ( [log, "in the chain1", "mvIntoPlc"] - , function (cb) { - log("in the chain", "moveIntoPlace") + ( function (cb) { fs.lstat(target, function (e) { log((e?"remove":"creating") + " " +target, "moveIntoPlace") if (e) rm(target, function (er, ok) { |