diff options
author | isaacs <i@foohack.com> | 2009-09-30 03:51:41 +0400 |
---|---|---|
committer | isaacs <i@foohack.com> | 2009-09-30 03:51:41 +0400 |
commit | 1b2b6968606c58bc8709a091136788da9b28b926 (patch) | |
tree | 7b1fb4ce95be84abdb3a2c3173be6b8ef65a76c5 /npm.js | |
parent | 8c72b78c2745a4d746e1a5958da6f3ce466987e6 (diff) |
Remove the command line curl in favor of http.cat.
Diffstat (limited to 'npm.js')
-rwxr-xr-x | npm.js | 18 |
1 files changed, 4 insertions, 14 deletions
@@ -68,26 +68,16 @@ npm.getSources = function npm_getSources () { }; npm.refreshSource = function npm_refreshSource (src) { - // debug("refresh the source: "+src); - var p = new node.Promise(); - - var uri = http.parseUri(src); - - // TODO: Replace this nonportable kludge with http.createClient. - var data = ""; - exec("curl "+src+" > .npm.catalog.tmp").addCallback(function (stdout, stderr) { - // debug("it worked!" + stdout); - // now read the file, and parse it. - node.fs.cat(".npm.catalog.tmp").addCallback(function (data) { + http.cat(src) + .addErrback(fail(p, "Couldn't load "+src)) + .addCallback(function (data) { try { data = JSON.parse(data); merge(CATALOG, data); p.emitSuccess(data); } catch (ex) { p.emitError(ex); return; } - }).addErrback(function () { p.emitError() }); - }); - + }); return p; }; |