fix: Monitor command exiting immediately due to arithmetic error

- Changed post-increment to pre-increment in cmd_monitor
  ((total_count++)) → ((++total_count)) to avoid set -e exit on ((0))
- Added invalidate_cache for accurate real-time status updates

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Michel Abboud 2026-01-29 00:32:34 +00:00
parent 831531eeb4
commit 5b274afbba

View File

@ -1097,6 +1097,9 @@ cmd_monitor() {
echo "" echo ""
while true; do while true; do
# Refresh cache for accurate status
invalidate_cache
clear clear
echo -e "${BOLD}${CYAN}Windows Container Monitor${RESET} - $(date '+%Y-%m-%d %H:%M:%S')" echo -e "${BOLD}${CYAN}Windows Container Monitor${RESET} - $(date '+%Y-%m-%d %H:%M:%S')"
echo -e "${DIM}$(printf '─%.0s' {1..70})${RESET}" echo -e "${DIM}$(printf '─%.0s' {1..70})${RESET}"
@ -1111,11 +1114,11 @@ cmd_monitor() {
local status local status
status=$(get_status "$v") status=$(get_status "$v")
if [[ "$status" != "not created" ]]; then if [[ "$status" != "not created" ]]; then
((total_count++)) ((++total_count))
if [[ "$status" == "running" ]]; then if [[ "$status" == "running" ]]; then
((running_count++)) ((++running_count))
else else
((stopped_count++)) ((++stopped_count))
fi fi
table_row "$v" "${VERSION_DISPLAY_NAMES[$v]}" "$status" "${VERSION_PORTS_WEB[$v]}" "${VERSION_PORTS_RDP[$v]}" table_row "$v" "${VERSION_DISPLAY_NAMES[$v]}" "$status" "${VERSION_PORTS_WEB[$v]}" "${VERSION_PORTS_RDP[$v]}"
fi fi