From a6039bcf36211d5375b09a0e1f660e8875a0405b Mon Sep 17 00:00:00 2001 From: anseki Date: Thu, 5 Mar 2015 17:39:46 +0900 Subject: [PATCH] Recover bug of `ScriptPW.Password` --- lib/read.bat | 5 +++-- lib/read.cs.js | 8 +++++++- lib/read.sh | 7 ++++--- lib/readline-sync.js | 1 + package.json | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/read.bat b/lib/read.bat index 035bfc5..689651e 100644 --- a/lib/read.bat +++ b/lib/read.bat @@ -3,7 +3,7 @@ setlocal setlocal ENABLEDELAYEDEXPANSION if "%1"=="noechoback" ( - call :exprog + call :read_s if ERRORLEVEL 1 exit /b 1 ) else ( set /p INPUT=CON @@ -13,7 +13,8 @@ set /p ="'%INPUT%'"= 0x4020 && charCode <= 0x407F ? + String.fromCharCode(charCode - 0x4000) : ''; + })); } catch (e) { WScript.StdErr.Write(e.description); WScript.Quit(1); diff --git a/lib/read.sh b/lib/read.sh index 1fb168b..6856115 100644 --- a/lib/read.sh +++ b/lib/read.sh @@ -1,4 +1,5 @@ -silent_read() { +# Silent Read +read_s() { stty --file=/dev/tty -echo echonl 2>/dev/null || \ stty -F /dev/tty -echo echonl 2>/dev/null || \ stty -f /dev/tty -echo echonl || exit 1 @@ -11,9 +12,9 @@ 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 && printf '\n' >/dev/tty || silent_read + IFS= read -rs INPUT /dev/null && printf '\n' >/dev/tty || read_s else - silent_read + read_s fi else IFS= read -r INPUT %Q%' + pathDone + '%Q%']; } else { cmdArgs = ['-c', + // Use `()`, not `{}` for `-c` (text param) '(' + SHELL_PATH + ' "' + SHELL_CMD + '" ' + args.join(' ') + '; echo $?>"' + pathStatus + '") 2>"' + pathStderr + '"' + ' |"' + process.execPath + '" "' + __dirname + '/encrypt.js"' + diff --git a/package.json b/package.json index c9469bd..fc44911 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "readline-sync", - "version": "0.7.4", + "version": "0.7.5", "title": "readlineSync", "description": "Synchronous Readline", "keywords": [