mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 17:24:45 +00:00
Implemented safer temp cleanup and error reporting while fixing folded-directory size fallback to prevent double counting and aligning Homebrew cleanup traps with safe removal.
This commit is contained in:
@@ -539,9 +539,14 @@ register_temp_dir() {
|
||||
mktemp_file() {
|
||||
local prefix="${1:-mole}"
|
||||
local temp
|
||||
local error_msg
|
||||
# Use TMPDIR if set, otherwise /tmp
|
||||
# Add .XXXXXX suffix to work with both BSD and GNU mktemp
|
||||
temp=$(mktemp "${TMPDIR:-/tmp}/${prefix}.XXXXXX") || return 1
|
||||
if ! error_msg=$(mktemp "${TMPDIR:-/tmp}/${prefix}.XXXXXX" 2>&1); then
|
||||
echo "Error: Failed to create temporary file: $error_msg" >&2
|
||||
return 1
|
||||
fi
|
||||
temp="$error_msg"
|
||||
register_temp_file "$temp"
|
||||
echo "$temp"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user