From 47dc874274c6e838c12c880c07b1bc996b00359d Mon Sep 17 00:00:00 2001 From: root Date: Sat, 27 Jan 2024 07:34:52 -0500 Subject: clean up tempfile --- wordpress/export-json.bash | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'wordpress/export-json.bash') diff --git a/wordpress/export-json.bash b/wordpress/export-json.bash index 714946e..fc65862 100644 --- a/wordpress/export-json.bash +++ b/wordpress/export-json.bash @@ -240,12 +240,11 @@ safety_pipe() { [ $# -ge 2 ] || return set -- "$(mktemp)" "$@" || return - if "${@:3}" > "$1" - then - "$2" < "$1" - else - return $? - fi + ( + trap "rm ${1@Q}" EXIT + "${@:3}" > "$1" && + $2 < "$1" + ) } export_JSON() -- cgit v1.2.3