From 99147f207915e794b4b9cd74841ffee6ec89d547 Mon Sep 17 00:00:00 2001 From: Jarell <91372088+jarelllama@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:50:27 +0800 Subject: [PATCH] Update --- functions/check_dead.sh | 3 ++- functions/test_functions.sh | 9 +++++++++ functions/validate_raw.sh | 3 ++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/functions/check_dead.sh b/functions/check_dead.sh index d6d6adb2b..206300621 100644 --- a/functions/check_dead.sh +++ b/functions/check_dead.sh @@ -103,7 +103,8 @@ check_dead() { mv dead.tmp dead_in_raw.tmp # Remove dead domains from raw file - comm -23 "$RAW" dead_in_raw.tmp > raw.tmp && mv raw.tmp "$RAW" + comm -23 "$RAW" dead_in_raw.tmp > raw.tmp + mv raw.tmp "$RAW" log_event "$( /dev/null && ! ls ./*.tmp &> /dev/null; then + return + fi + printf "\e[1m[warn] Temporary files were not removed:\e[0m\n" + ls x?? ./*.tmp 2> /dev/null + error=true +} + function check_output { cmp -s "$1" "$2" && return # Return if files are the same printf "\e[1m[warn] %s file is not as expected:\e[0m\n" "$3" diff --git a/functions/validate_raw.sh b/functions/validate_raw.sh index ef24ebc17..b7f836e2c 100644 --- a/functions/validate_raw.sh +++ b/functions/validate_raw.sh @@ -145,7 +145,8 @@ validate_raw() { # Save changes to raw file and raw light file printf "%s\n" "$domains" > "$RAW" format_file "$RAW" - comm -12 "$RAW" "$RAW_LIGHT" > light.tmp && mv light.tmp "$RAW_LIGHT" + comm -12 "$RAW" "$RAW_LIGHT" > light.tmp + mv light.tmp "$RAW_LIGHT" total_whitelisted_count="$(( whitelisted_count + whitelisted_tld_count ))" after_count="$(wc -l < "$RAW")"