From bdb443da72cabaaea705a2f036bce0f81453dff6 Mon Sep 17 00:00:00 2001 From: Developer Date: Fri, 20 Mar 2026 00:06:24 -0400 Subject: [PATCH] CRITICAL FIX: Add /dev/tty error handling to handle_loadwatch_analyzer() and remove pipe from show_system_overview() - Fix line 482: handle_loadwatch_analyzer() read without error handler * Add /dev/tty redirection with proper error handling * Returns gracefully if read fails instead of crashing - Fix line 126: show_system_overview() uses pipe to sed * Replace pipe with bash parameter expansion to avoid pipe failures * Remove unsafe sed dependency, use ${var%,} to trim trailing comma * More robust error handling Impact: Prevents additional crash scenarios and improves reliability of system display. --- launcher.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/launcher.sh b/launcher.sh index 81b3296..8fcc30d 100755 --- a/launcher.sh +++ b/launcher.sh @@ -123,8 +123,8 @@ show_system_overview() { # PHP Versions if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then echo -n " PHP Versions: " - printf '%s, ' "${SYS_PHP_VERSIONS[@]}" | sed 's/, $//' - echo "" + local php_list=$(printf '%s, ' "${SYS_PHP_VERSIONS[@]}") + echo "${php_list%, }" fi # Firewall @@ -479,7 +479,9 @@ handle_loadwatch_analyzer() { echo -e "──────────────────────────────────────────────────────────────" echo -n "Select time range: " - read -r range_choice < /dev/tty + if ! read -r range_choice /dev/null; then + return 0 # Exit if read fails + fi case "$range_choice" in 1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;