fix: Read directly from /dev/tty for menu interaction, suppress errors gracefully

This commit is contained in:
Developer
2026-03-19 20:34:19 -04:00
parent e40c281cbf
commit aaae6adfb9
+7 -15
View File
@@ -692,13 +692,8 @@ startup_detection() {
print_success "Detection complete! Cached for 1 hour." print_success "Detection complete! Cached for 1 hour."
echo "" echo ""
# Try to read from tty if available, otherwise from stdin # Read from terminal (use /dev/tty directly)
if [ -t 0 ]; then read -p "Press Enter to continue..." 2>/dev/null </dev/tty || true
read -p "Press Enter to continue..."
else
# stdin available (e.g., from pipe), use it
read -p "Press Enter to continue..." || true
fi
fi fi
} }
@@ -713,15 +708,12 @@ main() {
while true; do while true; do
show_main_menu show_main_menu
# Handle read with/without terminal # Read from terminal (use /dev/tty directly for interaction)
if [ -t 0 ]; then if read -r choice 2>/dev/null </dev/tty; then
read -r choice : # Input read successfully
else else
read -r choice || { # No terminal available, exit gracefully
echo "" exit 0
echo "stdin closed, exiting launcher"
exit 0
}
fi fi
case $choice in case $choice in