Change: print \n whith read -s

This commit is contained in:
anseki 2015-03-04 20:58:55 +09:00
parent fc50c96368
commit 7a37871966
2 changed files with 3 additions and 5 deletions

View file

@ -11,8 +11,7 @@ silent_read() {
if [ "$1" = "noechoback" ]; then if [ "$1" = "noechoback" ]; then
# Try `-s` option. *ksh have it that not `--silent`. Therefore, don't try it. # Try `-s` option. *ksh have it that not `--silent`. Therefore, don't try it.
if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
IFS= read -rs INPUT </dev/tty 2>/dev/null || silent_read IFS= read -rs INPUT </dev/tty 2>/dev/null && printf '\n' >/dev/tty || silent_read
printf '\n' >/dev/tty
else else
silent_read silent_read
fi fi

View file

@ -238,11 +238,10 @@ exports.question = function(query, options) {
options); options);
}; };
exports.keyIn = function(message) { exports.keyIn = function(query) {
return _readlineSync( return _readlineSync(
/* jshint eqnull:true */ /* jshint eqnull:true */
message != null ? message : '', query != null ? query : '',
/* jshint eqnull:false */ /* jshint eqnull:false */
{keyIn: true}); {keyIn: true});
}; };