Fix: The leading and trailing white spaces are removed
This commit is contained in:
parent
db8e754338
commit
ca90461c57
4 changed files with 7 additions and 6 deletions
|
@ -6,6 +6,6 @@ if "%1"=="noechoback" (
|
|||
) else (
|
||||
set /p LINE=<CON >CON
|
||||
)
|
||||
set /p DUM="%LINE%"<NUL
|
||||
set /p ="'%LINE%'"<NUL
|
||||
endlocal
|
||||
exit /b 0
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
if [ "$1" = "noechoback" ]; then
|
||||
stty --file=/dev/tty -echo echonl || stty -F /dev/tty -echo echonl || stty -f /dev/tty -echo echonl || exit 1
|
||||
read LINE </dev/tty
|
||||
IFS= read LINE </dev/tty
|
||||
stty --file=/dev/tty echo -echonl || stty -F /dev/tty echo -echonl || stty -f /dev/tty echo -echonl
|
||||
# printf '\n' >/dev/tty
|
||||
else
|
||||
read LINE </dev/tty
|
||||
IFS= read LINE </dev/tty
|
||||
fi
|
||||
printf '%s' "$LINE"
|
||||
printf '%s' "'$LINE'"
|
||||
exit 0
|
||||
|
|
|
@ -105,7 +105,7 @@ function _readlineShell(noEchoBack) {
|
|||
shellPath = '/bin/sh';
|
||||
args = ['-c',
|
||||
'DATA=`(' + shellPath + ' "' + __dirname + '/read.sh"' + optEchoBack + ')`; RTN=$?;' +
|
||||
' if [ $RTN -eq 0 ]; then (echo $DATA |' +
|
||||
' if [ $RTN -eq 0 ]; then (printf \'%s\' "$DATA" |' +
|
||||
'"' + process.execPath + '" "' + __dirname + '/encrypt.js"' +
|
||||
' "' + ALGORITHM_CIPHER + '" "' + password + '"' +
|
||||
' >"' + pathStdout + '") fi;' +
|
||||
|
@ -120,6 +120,7 @@ function _readlineShell(noEchoBack) {
|
|||
shellStdout =
|
||||
decipher.update(fs.readFileSync(pathStdout, {encoding: 'binary'}), 'hex', encoding) +
|
||||
decipher.final(encoding);
|
||||
shellStdout = shellStdout.replace(/^'|'$/g, '');
|
||||
}
|
||||
|
||||
fs.unlinkSync(pathStdout);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "readline-sync",
|
||||
"version": "0.5.2",
|
||||
"version": "0.5.3",
|
||||
"title": "readlineSync",
|
||||
"description": "Synchronous Readline",
|
||||
"keywords": [
|
||||
|
|
Loading…
Reference in a new issue