From 7a37871966ba193ee454dbefcf144443b842ea55 Mon Sep 17 00:00:00 2001 From: anseki Date: Wed, 4 Mar 2015 20:58:55 +0900 Subject: [PATCH] Change: print `\n` whith `read -s` --- lib/read.sh | 3 +-- lib/readline-sync.js | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/read.sh b/lib/read.sh index 39ddc57..1fb168b 100644 --- a/lib/read.sh +++ b/lib/read.sh @@ -11,8 +11,7 @@ silent_read() { if [ "$1" = "noechoback" ]; then # Try `-s` option. *ksh have it that not `--silent`. Therefore, don't try it. if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then - IFS= read -rs INPUT /dev/null || silent_read - printf '\n' >/dev/tty + IFS= read -rs INPUT /dev/null && printf '\n' >/dev/tty || silent_read else silent_read fi diff --git a/lib/readline-sync.js b/lib/readline-sync.js index 0d13fda..e117237 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -238,11 +238,10 @@ exports.question = function(query, options) { options); }; -exports.keyIn = function(message) { +exports.keyIn = function(query) { return _readlineSync( /* jshint eqnull:true */ - message != null ? message : '', + query != null ? query : '', /* jshint eqnull:false */ {keyIn: true}); }; -