Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Closes GH-634 Remove stdin's error listener when done

  • Loading branch information...
commit b031c571d523a3227bfa0e4b0dc92dd8498f7f74 1 parent 82d6be2
@isaacs isaacs authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  lib/utils/prompt.js
View
3  lib/utils/prompt.js
@@ -33,6 +33,7 @@ function read (def, cb) {
val = val.substr(0, val.indexOf("\n"))
stdin.pause()
stdin.removeListener("data", D)
+ stdin.removeListener("error", cb)
val = val.trim() || def
cb(null, val)
}
@@ -44,12 +45,14 @@ function silentRead (def, cb) {
, val = ""
stdio.setRawMode(true)
stdin.resume()
+ stdin.on("error", cb)
stdin.on("data", function D (c) {
c = "" + c
switch (c) {
case "\n": case "\r": case "\r\n": case "\u0004":
stdio.setRawMode(false)
stdin.removeListener("data", D)
+ stdin.removeListener("error", cb)
val = val.trim() || def
process.stdout.write("\n")
process.stdout.flush()
Please sign in to comment.
Something went wrong with that request. Please try again.