Skip to content
Myr

when the user enters nothing prompt for password again

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

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 1d4de04 · Browse files · 1 file+4 added−1 removed
This commit

State

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

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:lib/commander.js+4 added-1 removed
748 unmodified lines
749 * @api public750 */751752Command.prototype.password = function(str, mask, fn){753 var self = this754 , buf = '';755756 // default mask757 if ('function' == typeof mask) {758 fn = mask;759 mask = '';760 }761762 tty.setRawMode(true);760 var buf = '';763 process.stdout.write(str);764765 // keypress766 process.stdin.on('keypress', function(c, key){767 if (key && 'enter' == key.name) {768 console.log();769 process.stdin.removeAllListeners('keypress');770 tty.setRawMode(false);771 if (!buf.trim().length) return self.password(str, mask, fn);772 fn(buf);773 return;774 }775
114 unmodified lines