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:
-rwxr-xr-xcli.js1
-rw-r--r--lib/adduser.js9
-rw-r--r--lib/utils/prompt.js7
-rwxr-xr-xnpm.js1
4 files changed, 10 insertions, 8 deletions
diff --git a/cli.js b/cli.js
index 41122118c..c4fe26fd5 100755
--- a/cli.js
+++ b/cli.js
@@ -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)
diff --git a/npm.js b/npm.js
index e106bfaad..834629e0f 100755
--- a/npm.js
+++ b/npm.js
@@ -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"))+"")