From f0b337b222e9719e05fc218de9ad3438c96354e8 Mon Sep 17 00:00:00 2001 From: shenmo Date: Mon, 10 Nov 2025 04:26:26 +0000 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E6=B8=85=E7=90=86/tmp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/apt-fast/ss-apt-fast | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tool/apt-fast/ss-apt-fast b/tool/apt-fast/ss-apt-fast index 57e10fa..38fb0ef 100755 --- a/tool/apt-fast/ss-apt-fast +++ b/tool/apt-fast/ss-apt-fast @@ -458,7 +458,17 @@ get_uris(){ msg "Failed to create tmp dir" "warning" msg "无法创建临时目录" "warning" exit 1 + + } + +cleanup_tmpdir() { + if [ -n "$tmpdir" ] && [ -d "$tmpdir" ]; then + rm -rf "$tmpdir" + fi +} +trap cleanup_tmpdir EXIT + ## --print-uris format is: # 'fileurl' filename filesize checksum_hint:filechecksum # 修改:process_package函数增加第二个参数表示当前线程的临时输出文件 @@ -580,6 +590,9 @@ get_uris(){ rm -f "$thread_file" fi done + # 清理临时目录 + cleanup_tmpdir + trap - EXIT # 移除临时目录的陷阱 # 合并显示信息 if [ -f "$tmpdir/display" ]; then