mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 21:20:09 +00:00
fix: temporarily disable pipefail to prevent process substitution failures during cleanup operations
This commit is contained in:
@@ -11,6 +11,13 @@ fix_broken_preferences() {
|
||||
|
||||
local broken_count=0
|
||||
|
||||
# Temporarily disable pipefail to prevent process substitution failures from interrupting
|
||||
local pipefail_was_set=false
|
||||
if [[ -o pipefail ]]; then
|
||||
pipefail_was_set=true
|
||||
set +o pipefail
|
||||
fi
|
||||
|
||||
while IFS= read -r plist_file; do
|
||||
[[ -f "$plist_file" ]] || continue
|
||||
|
||||
@@ -49,5 +56,10 @@ fix_broken_preferences() {
|
||||
done < <(command find "$byhost_dir" -name "*.plist" -type f 2> /dev/null || true)
|
||||
fi
|
||||
|
||||
# Restore pipefail if it was previously set
|
||||
if [[ "$pipefail_was_set" == "true" ]]; then
|
||||
set -o pipefail
|
||||
fi
|
||||
|
||||
echo "$broken_count"
|
||||
}
|
||||
|
||||
@@ -191,12 +191,24 @@ opt_saved_state_cleanup() {
|
||||
local state_dir="$HOME/Library/Saved Application State"
|
||||
|
||||
if [[ -d "$state_dir" ]]; then
|
||||
# Temporarily disable pipefail to prevent process substitution failures from interrupting
|
||||
local pipefail_was_set=false
|
||||
if [[ -o pipefail ]]; then
|
||||
pipefail_was_set=true
|
||||
set +o pipefail
|
||||
fi
|
||||
|
||||
while IFS= read -r -d '' state_path; do
|
||||
if should_protect_path "$state_path"; then
|
||||
continue
|
||||
fi
|
||||
safe_remove "$state_path" true > /dev/null 2>&1 || true
|
||||
done < <(command find "$state_dir" -type d -name "*.savedState" -mtime "+$MOLE_SAVED_STATE_AGE_DAYS" -print0 2> /dev/null)
|
||||
|
||||
# Restore pipefail if it was previously set
|
||||
if [[ "$pipefail_was_set" == "true" ]]; then
|
||||
set -o pipefail
|
||||
fi
|
||||
fi
|
||||
|
||||
opt_msg "App saved states optimized"
|
||||
|
||||
Reference in New Issue
Block a user