~ecs/tm

0c962e14f506fc41f4e487b4625ebca7a357dc37 — evantj 3 years ago 9b9f65e
Replace mktemp with something POSIX
1 files changed, 5 insertions(+), 2 deletions(-)

M lib.sh
M lib.sh => lib.sh +5 -2
@@ 60,7 60,10 @@ export TM_WS="${TM_WS:-$TM_DIR/..}"
export TM_IGNORE="${TM_IGNORE:-$TM_WS/.tmignore}"

TMPDIR="${TMPDIR:-/tmp}"
# TODO: replace this with something POSIX
TMPDIR="$(mktemp -d "$TMPDIR/tm.XXXXXXX")"

tmpname=0
while ! mkdir -- "$TMPDIR/tm.$((++tmpname))" 2>/dev/null; do :; done
TMPDIR="$TMPDIR/tm.$tmpname"

trap "rm -rf '$TMPDIR'; exit" INT
trap "rm -rf '$TMPDIR'" EXIT