1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-07 09:25:43 +00:00

fix: resolve password input issue with special characters

Remove -icanon mode from stty settings to fix password authentication
failures when passwords contain special characters like '.' or '@'.

The non-canonical mode (-icanon min 1 time 0) caused character loss
in Terminal.app. Using only -echo keeps canonical mode which provides
more reliable character handling across all terminal emulators.
This commit is contained in:
程序员阿江(Relakkes)
2026-01-15 13:26:06 +08:00
parent 518b57024c
commit f8cb96d328

View File

@@ -66,11 +66,11 @@ _request_password() {
printf "${PURPLE}${ICON_ARROW}${NC} Password: " > "$tty_path"
# Disable terminal echo to hide password input
stty -echo -icanon min 1 time 0 < "$tty_path" 2> /dev/null || true
# Disable terminal echo to hide password input (keep canonical mode for reliable input)
stty -echo < "$tty_path" 2> /dev/null || true
IFS= read -r password < "$tty_path" || password=""
# Restore terminal echo immediately
stty echo icanon < "$tty_path" 2> /dev/null || true
stty echo < "$tty_path" 2> /dev/null || true
printf "\n" > "$tty_path"