blob: 41fab30008f7024c1a62f21c5765906690d9bf4b [file] [log] [blame]
William A. Kennington III2030ea52022-07-19 17:06:39 -07001#!/bin/bash
2TMPDIR="$(mktemp -d --tmpdir "${TMPTMPL-tmp.XXXXXXXXXX}")" || exit
Patrick Williams8c0113f2022-12-08 06:23:37 -06003function rmtmp() {
4 if [ -n "${TMP_DEBUG-}" ]; then
5 echo "Removing TMPDIR=$TMPDIR" >&2
6 fi
7 rm -rf -- "$TMPDIR"
William A. Kennington III2030ea52022-07-19 17:06:39 -07008}
9trap rmtmp EXIT
10export TMPDIR
11if [ -n "${TMP_DEBUG-}" ]; then
Patrick Williams8c0113f2022-12-08 06:23:37 -060012 echo "Exec $* with TMPDIR=$TMPDIR" >&2
William A. Kennington III2030ea52022-07-19 17:06:39 -070013fi
14"$@"