diff --git a/lib/core/file_ops.sh b/lib/core/file_ops.sh index e99e628..fc5cfee 100644 --- a/lib/core/file_ops.sh +++ b/lib/core/file_ops.sh @@ -434,13 +434,6 @@ safe_find_delete() { find_args+=("-mtime" "+$age_days") fi - # 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 - # Iterate results to respect should_protect_path while IFS= read -r -d '' match; do if should_protect_path "$match"; then @@ -449,11 +442,6 @@ safe_find_delete() { safe_remove "$match" true || true done < <(command find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true) - # Restore pipefail if it was previously set - if [[ "$pipefail_was_set" == "true" ]]; then - set -o pipefail - fi - return 0 } @@ -493,13 +481,6 @@ safe_sudo_find_delete() { find_args+=("-mtime" "+$age_days") fi - # 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 - # Iterate results to respect should_protect_path while IFS= read -r -d '' match; do if should_protect_path "$match"; then @@ -508,11 +489,6 @@ safe_sudo_find_delete() { safe_sudo_remove "$match" || true done < <(sudo find "$base_dir" "${find_args[@]}" -print0 2> /dev/null || true) - # Restore pipefail if it was previously set - if [[ "$pipefail_was_set" == "true" ]]; then - set -o pipefail - fi - return 0 } diff --git a/lib/optimize/maintenance.sh b/lib/optimize/maintenance.sh index 4e5dc0c..c1f004c 100644 --- a/lib/optimize/maintenance.sh +++ b/lib/optimize/maintenance.sh @@ -11,13 +11,6 @@ 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 @@ -32,7 +25,7 @@ fix_broken_preferences() { plutil -lint "$plist_file" > /dev/null 2>&1 && continue safe_remove "$plist_file" true > /dev/null 2>&1 || true - ((broken_count++)) + ((broken_count++)) || true done < <(command find "$prefs_dir" -maxdepth 1 -name "*.plist" -type f 2> /dev/null || true) # Check ByHost preferences. @@ -52,14 +45,9 @@ fix_broken_preferences() { plutil -lint "$plist_file" > /dev/null 2>&1 && continue safe_remove "$plist_file" true > /dev/null 2>&1 || true - ((broken_count++)) + ((broken_count++)) || true 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" } diff --git a/lib/optimize/tasks.sh b/lib/optimize/tasks.sh index 42d27e6..6260263 100644 --- a/lib/optimize/tasks.sh +++ b/lib/optimize/tasks.sh @@ -191,24 +191,12 @@ 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"