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.
This commit is contained in:
Developer
2026-03-20 00:06:24 -04:00
parent b9a72bff75
commit bdb443da72
+5 -3
View File
@@ -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/tty 2>/dev/null; then
return 0 # Exit if read fails
fi
case "$range_choice" in
1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;