From 5eb2edf1cd0525999ff0e7b82a84119448be974d Mon Sep 17 00:00:00 2001 From: Tw93 Date: Thu, 8 Jan 2026 16:17:39 +0800 Subject: [PATCH] fix: resolve spinner display and Ctrl+C handling issues - fix(clean): stop spinner before safe_clean outputs results - fix(uninstall): handle Ctrl+C during application scanning --- bin/uninstall.sh | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/bin/uninstall.sh b/bin/uninstall.sh index f16e017..389e222 100755 --- a/bin/uninstall.sh +++ b/bin/uninstall.sh @@ -59,6 +59,24 @@ scan_applications() { local temp_file temp_file=$(create_temp_file) + # Local spinner_pid for cleanup + local spinner_pid="" + + # Trap to handle Ctrl+C during scan + local scan_interrupted=false + # shellcheck disable=SC2329 # Function invoked indirectly via trap + trap_scan_cleanup() { + scan_interrupted=true + if [[ -n "$spinner_pid" ]]; then + kill -TERM "$spinner_pid" 2> /dev/null || true + wait "$spinner_pid" 2> /dev/null || true + fi + printf "\r\033[K" >&2 + rm -f "$temp_file" "${temp_file}.sorted" "${temp_file}.progress" 2> /dev/null || true + exit 130 + } + trap trap_scan_cleanup INT + local current_epoch current_epoch=$(get_epoch_seconds) @@ -228,7 +246,6 @@ scan_applications() { local progress_file="${temp_file}.progress" echo "0" > "$progress_file" - local spinner_pid="" ( # shellcheck disable=SC2329 # Function invoked indirectly via trap cleanup_spinner() { exit 0; }