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": [