mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 17:30:05 +00:00
fix: P1/P2 issues in file ops, menu state, and logging
- Fix safe_sudo_remove early exit on error (P1) - Fix menu filter state leakage in paginated menu (P2) - Fix cleanup of MOLE_MENU_FILTER_NAMES in app selector (P2) - Correct log_operation signature for memory dumps (P2) - Apply minor formatting fixes to dev cleanup module
This commit is contained in:
@@ -179,7 +179,7 @@ clean_deep_system() {
|
||||
if oplog_enabled && [[ "$total_size_kb" -gt 0 ]]; then
|
||||
local size_human
|
||||
size_human=$(bytes_to_human "$((total_size_kb * 1024))")
|
||||
log_operation "[clean] REMOVED $mem_reports_dir ($file_count files, $size_human)"
|
||||
log_operation "clean" "REMOVED" "$mem_reports_dir" "$file_count files, $size_human"
|
||||
fi
|
||||
else
|
||||
log_info "[DRY-RUN] Would remove $file_count old memory exception reports ($total_size_kb KB)"
|
||||
|
||||
@@ -366,8 +366,7 @@ safe_sudo_remove() {
|
||||
|
||||
local output
|
||||
local ret
|
||||
output=$(sudo rm -rf "$path" 2>&1) # safe_remove
|
||||
ret=$?
|
||||
output=$(sudo rm -rf "$path" 2>&1) || ret=$? # safe_remove
|
||||
|
||||
if [[ $ret -eq 0 ]]; then
|
||||
log_operation "${MOLE_CURRENT_COMMAND:-clean}" "REMOVED" "$path" "$size_human"
|
||||
|
||||
@@ -169,7 +169,7 @@ select_apps_for_uninstall() {
|
||||
local exit_code=$?
|
||||
|
||||
# Clean env leakage for safety
|
||||
unset MOLE_MENU_META_EPOCHS MOLE_MENU_META_SIZEKB
|
||||
unset MOLE_MENU_META_EPOCHS MOLE_MENU_META_SIZEKB MOLE_MENU_FILTER_NAMES
|
||||
# leave MOLE_MENU_SORT_DEFAULT untouched if user set it globally
|
||||
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
|
||||
@@ -182,6 +182,7 @@ paginated_multi_select() {
|
||||
# Cleanup function
|
||||
cleanup() {
|
||||
trap - EXIT INT TERM
|
||||
unset MOLE_READ_KEY_FORCE_CHAR
|
||||
export MOLE_MENU_SORT_MODE="${sort_mode:-name}"
|
||||
export MOLE_MENU_SORT_REVERSE="${sort_reverse:-false}"
|
||||
restore_terminal
|
||||
@@ -862,6 +863,7 @@ paginated_multi_select() {
|
||||
|
||||
trap - EXIT INT TERM
|
||||
MOLE_SELECTION_RESULT="$final_result"
|
||||
unset MOLE_READ_KEY_FORCE_CHAR
|
||||
export MOLE_MENU_SORT_MODE="${sort_mode:-name}"
|
||||
export MOLE_MENU_SORT_REVERSE="${sort_reverse:-false}"
|
||||
restore_terminal
|
||||
|
||||
Reference in New Issue
Block a user