diff options
-rwxr-xr-x | cli.js | 1 | ||||
-rw-r--r-- | lib/adduser.js | 9 | ||||
-rw-r--r-- | lib/utils/prompt.js | 7 | ||||
-rwxr-xr-x | npm.js | 1 |
4 files changed, 10 insertions, 8 deletions
@@ -80,7 +80,6 @@ function errorHandler (er) { if (!er) { itWorked = true log("ok") - if (npm.SHOULD_EXIT) process.exit() return } sys.error("") diff --git a/lib/adduser.js b/lib/adduser.js index 35e27af71..a554e7d8f 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -20,11 +20,10 @@ function adduser (args, cb) { if (!crypto) return cb(new Error( "You must compile node with ssl support to use the adduser feature")) - var u = - { u : npm.config.get("username") - , p : npm.config.get("_password") - , e : npm.config.get("email") - } + var u = { u : npm.config.get("username") + , p : npm.config.get("_password") + , e : npm.config.get("email") + } , changed = false promiseChain(cb) diff --git a/lib/utils/prompt.js b/lib/utils/prompt.js index 9aedbaa1e..43de8dfcc 100644 --- a/lib/utils/prompt.js +++ b/lib/utils/prompt.js @@ -3,6 +3,7 @@ module.exports = prompt var stdin , log = require("./log") + , buffer = "" function prompt (p, def, silent, cb) { if (!stdin) stdin = process.openStdin() @@ -15,8 +16,12 @@ function prompt (p, def, silent, cb) { stdin.setEncoding("utf8") stdin.on("error", cb) stdin.on("data", function D (chunk) { - val += chunk + val += buffer + chunk + buffer = "" if (val.indexOf("\n") !== -1) { + buffer = val.substr(val.indexOf("\n")) + val = val.substr(0, val.indexOf("\n")) + stdin.pause() stdin.removeListener("data", D) val = val.trim() || def cb(null, val) @@ -15,7 +15,6 @@ var npm = exports , fs = require("fs") npm.commands = {} -npm.SHOULD_EXIT = true try { var j = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))+"") |