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
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-05-07 09:22:41 +0400
committerisaacs <i@izs.me>2010-05-07 09:22:41 +0400
commite5403cad129045bff60e2c3962650d2dfd8f0772 (patch)
tree595bc6f005ad59b8d0970dcc324945970aa77a0d /lib
parent040846bfb1841d7475e51a2bda062320faad5436 (diff)
Make sure to stringify the result from fs.readFile, since it'll be a buffer soon.
Diffstat (limited to 'lib')
-rw-r--r--lib/build.js2
-rw-r--r--lib/utils/ini.js4
-rw-r--r--lib/utils/read-json.js1
3 files changed, 4 insertions, 3 deletions
diff --git a/lib/build.js b/lib/build.js
index 2e6408635..b419cf209 100644
--- a/lib/build.js
+++ b/lib/build.js
@@ -334,7 +334,7 @@ function linkBins (pkg, cb) {
function shimTest (from, to, dep, cb) {
// if it needs a shim, then call writeShim
// otherwise, just link it in.
- if (/\.(node|js)$/(from)) return writeShim(from, to, dep, cb)
+ if (from.match(/\.(node|js)$/)) return writeShim(from, to, dep, cb)
fs.readFile(from, function (er, data) {
if (er) return cb(er)
var envNode = from.match(/#!(\/usr\/bin\/)?env node/)
diff --git a/lib/utils/ini.js b/lib/utils/ini.js
index bf71ed3c7..e0d578135 100644
--- a/lib/utils/ini.js
+++ b/lib/utils/ini.js
@@ -62,7 +62,7 @@ function getConfig () {
var config
log(configfile, "configfile")
try {
- config = fs.readFileSync(configfile, "utf8")
+ config = "" + fs.readFileSync(configfile, "utf8")
// TODO v0.0.8: remove this JSON parse next version
try {
config = JSON.parse(config)
@@ -89,7 +89,7 @@ function getKey () {
]
for (var i = 0, l = keys.length; i < l; i ++) {
try {
- return (privateKey = fs.readFileSync(keys[i]))
+ return (privateKey = "" + fs.readFileSync(keys[i]))
} catch (e) {}
}
throw new Error("No private key found.")
diff --git a/lib/utils/read-json.js b/lib/utils/read-json.js
index 728934956..72c032cc1 100644
--- a/lib/utils/read-json.js
+++ b/lib/utils/read-json.js
@@ -8,6 +8,7 @@ var fs = require("fs"),
function readJson (jsonFile, cb) {
log(jsonFile, "readJson");
fs.readFile(jsonFile, function (er, jsonString) {
+ jsonString = jsonString + ""
if (er) return cb(er, jsonString);
var json;
try {