Skip to content
Myr

Merge pull request #87 from focusaurus/keypress_node_0.8.8

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fix password on node 0.8.8. Make backward compatible with 0.6.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 605441b, 1b37ea4 · Browse files · 2 files+15 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+15 added−5 removed

  • other:+15 added−5 removed

2 files+15 added−5 removed

modified:lib/commander.js+13 added-3 removed
8 unmodified lines
9 */1011var EventEmitter = require('events').EventEmitter12 , path = require('path')13 , keypress = require('keypress')14 , tty = require('tty')15 , basename = path.basename;1617/**
856 unmodified lines
874 fn = mask;875 mask = '';876 }877877 process.stdin.resume();878 process.stdin.setRawMode(true);878 keypress(process.stdin);879880 function setRawMode(mode) {881 if (process.stdin.setRawMode) {882 process.stdin.setRawMode(mode);883 } else {884 tty.setRawMode(mode);885 }886 };887 setRawMode(true);888 process.stdout.write(str);889890 // keypress891 process.stdin.on('keypress', function(c, key){892 if (key && 'enter' == key.name) {893 console.log();894 process.stdin.pause();895 process.stdin.removeAllListeners('keypress');886 process.stdin.setRawMode(false);896 setRawMode(false);897 if (!buf.trim().length) return self.password(str, mask, fn);898 fn(buf);899 return;900 }
148 unmodified lines
modified:package.json+2 added-2 removed