diff options
author | isaacs <i@izs.me> | 2010-11-07 20:20:10 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-11-07 20:20:10 +0300 |
commit | f3566540cf38777dd6ae30b30d14797f3a1d10c2 (patch) | |
tree | af450d9e03aac4b28e0ae5d5ffea6ef5bba1d706 | |
parent | 4624763b03d791c2cab2dbecdbf23b81c357b480 (diff) |
Roll back af93028 in lib/utils/prompt.js
This introduced a bug which breaks init and adduser.
-rw-r--r-- | lib/utils/prompt.js | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/utils/prompt.js b/lib/utils/prompt.js index 5bfc16adf..5035caece 100644 --- a/lib/utils/prompt.js +++ b/lib/utils/prompt.js @@ -3,19 +3,16 @@ module.exports = prompt var log = require("./log") , buffer = "" - , output = require("./output") , stdio = process.binding("stdio") - , npm = require("../../npm") function prompt (p, def, silent, cb) { - var outfd = npm.config.get("outfd") if (!cb) cb = silent, silent = false if (!cb) cb = def, def = undefined if (def) p += "("+(silent ? "<hidden>" : def)+") " - output.write(outfd, p, function () { - if (silent) silentRead(def, cb) - else read(def, cb) - }) + process.stdout.write(p) + process.stdout.flush() + + return (silent) ? silentRead(def, cb) : read(def, cb) } function read (def, cb) { @@ -52,10 +49,10 @@ function silentRead (def, cb) { stdio.setRawMode(false) stdin.removeListener("data", D) val = val.trim() || def + process.stdout.write("\n") + process.stdout.flush() stdin.pause() - output.write(npm.config.get("outfd"), "\n", function () { - cb(null, val) - }) + return cb(null, val) case "\u0003": case "\0": return cb("cancelled") break |