mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 16:45:07 +00:00
fix(purge): resolve trap conflict between purge.sh and project.sh
- Add guard flag in cleanup_monitor to prevent duplicate execution - Check for existing trap in project.sh before setting new one - Prevents crash when user presses Ctrl-C or scan process fails
This commit is contained in:
@@ -68,8 +68,13 @@ perform_purge() {
|
||||
local stats_dir="${XDG_CACHE_HOME:-$HOME/.cache}/mole"
|
||||
local monitor_pid=""
|
||||
|
||||
# Cleanup function
|
||||
# Cleanup function - use flag to prevent duplicate execution
|
||||
_cleanup_done=false
|
||||
cleanup_monitor() {
|
||||
# Prevent multiple cleanup executions from trap conflicts
|
||||
[[ "$_cleanup_done" == "true" ]] && return
|
||||
_cleanup_done=true
|
||||
|
||||
# Remove scanning file to stop monitor
|
||||
rm -f "$stats_dir/purge_scanning" 2> /dev/null || true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user