From 5b274afbbacd68293707e49d3711813ac3b50973 Mon Sep 17 00:00:00 2001 From: Michel Abboud Date: Thu, 29 Jan 2026 00:32:34 +0000 Subject: [PATCH] fix: Monitor command exiting immediately due to arithmetic error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- winctl.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/winctl.sh b/winctl.sh index c94578d..01ae912 100755 --- a/winctl.sh +++ b/winctl.sh @@ -1097,6 +1097,9 @@ cmd_monitor() { echo "" while true; do + # Refresh cache for accurate status + invalidate_cache + clear echo -e "${BOLD}${CYAN}Windows Container Monitor${RESET} - $(date '+%Y-%m-%d %H:%M:%S')" echo -e "${DIM}$(printf '─%.0s' {1..70})${RESET}" @@ -1111,11 +1114,11 @@ cmd_monitor() { local status status=$(get_status "$v") if [[ "$status" != "not created" ]]; then - ((total_count++)) + ((++total_count)) if [[ "$status" == "running" ]]; then - ((running_count++)) + ((++running_count)) else - ((stopped_count++)) + ((++stopped_count)) fi table_row "$v" "${VERSION_DISPLAY_NAMES[$v]}" "$status" "${VERSION_PORTS_WEB[$v]}" "${VERSION_PORTS_RDP[$v]}" fi