zpass: prompt failsafe, turn tty back on on interrupt
This commit is contained in:
parent
e64e378671
commit
98ce7db405
1 changed files with 11 additions and 7 deletions
|
|
@ -3,13 +3,17 @@
|
||||||
# $1 = prompt
|
# $1 = prompt
|
||||||
console_prompt_hidden()
|
console_prompt_hidden()
|
||||||
{
|
{
|
||||||
local prompt
|
(
|
||||||
printf "%s" "$1" >&2
|
_tty_on() { stty echo; }
|
||||||
stty -echo
|
trap _tty_on INT
|
||||||
read -r prompt || return $?
|
local prompt
|
||||||
stty echo
|
printf "%s" "$1" >&2
|
||||||
printf "\n" >&2
|
stty -echo
|
||||||
echo "$prompt"
|
read -r prompt || { stty echo; return 1; }
|
||||||
|
stty echo
|
||||||
|
printf "\n" >&2
|
||||||
|
echo "$prompt"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1 = prompt message
|
# $1 = prompt message
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue