~rkta/quiltutils

67f64a4e953de9d02914500c934aa1ef4134fb24 — Rene Kita 5 months ago ebc0dd9
Do not use a temporary file
1 files changed, 5 insertions(+), 16 deletions(-)

M qclean
M qclean => qclean +5 -16
@@ 12,19 12,8 @@ test "$DEBUG" && print="echo"

qorphan="${PORPHAN:-qorphan}"

trap 'trap HUP; rm -f $tdir; kill -1' HUP
trap 'trap QUIT; rm -f $tdir; kill -3 $$' QUIT
trap 'trap INT; rm -f $tdir; kill -2 $$' INT
trap 'trap PIPE; rm -f $tdir; kill -13 $$' PIPE
trap 'trap TERM; rm -f $tdir; kill -15 $$' TERM
trap 'rm -rf $tdir' EXIT

tdir="${TMPDIR:-/tmp}"/$$
mkdir "$tdir" || exit 1

"$qorphan" "$@" > "$tdir"/orphans || exit 1

while read -r bf
do
	$print rm "$bf"
done < "$tdir"/orphans
"$qorphan" "$@" |
	while read -r f
	do
		$print rm "$f"
	done