mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 21:55:08 +00:00
fix(clean): guard DRY_RUN against unbound variable in system.sh
Change "$DRY_RUN" to "${DRY_RUN:-}" so the check is safe under
set -euo pipefail when DRY_RUN is not exported by the caller (e.g.
unit tests that source lib/clean/system.sh directly without going
through bin/clean.sh which initialises the variable).
This commit is contained in:
@@ -186,7 +186,7 @@ clean_deep_system() {
|
||||
done < <(sudo find "$mem_reports_dir" -type f -mtime +30 -print0 2> /dev/null || true)
|
||||
|
||||
if [[ "$file_count" -gt 0 ]]; then
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
if [[ "${DRY_RUN:-}" != "true" ]]; then
|
||||
if safe_sudo_find_delete "$mem_reports_dir" "*" "30" "f"; then
|
||||
mem_cleaned=1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user