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:
+5
-3
@@ -123,8 +123,8 @@ show_system_overview() {
|
|||||||
# PHP Versions
|
# PHP Versions
|
||||||
if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then
|
if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then
|
||||||
echo -n " PHP Versions: "
|
echo -n " PHP Versions: "
|
||||||
printf '%s, ' "${SYS_PHP_VERSIONS[@]}" | sed 's/, $//'
|
local php_list=$(printf '%s, ' "${SYS_PHP_VERSIONS[@]}")
|
||||||
echo ""
|
echo "${php_list%, }"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Firewall
|
# Firewall
|
||||||
@@ -479,7 +479,9 @@ handle_loadwatch_analyzer() {
|
|||||||
echo -e "──────────────────────────────────────────────────────────────"
|
echo -e "──────────────────────────────────────────────────────────────"
|
||||||
echo -n "Select time range: "
|
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
|
case "$range_choice" in
|
||||||
1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;
|
1) run_module "diagnostics" "loadwatch-analyzer.sh" "-r" "1h" ;;
|
||||||
|
|||||||
Reference in New Issue
Block a user