9a67a486c2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1104 788f1e2b-df1e-0410-8736-df70ead52e1b
18 lines
508 B
Bash
18 lines
508 B
Bash
# As a security measure refuse to proceed if mktemp is not available.
|
|
pathfind mktemp || { err "Couldn't find 'mktemp'; aborting."; exit 1; }
|
|
|
|
# Avoid issues with /tmp directory on Windows/Cygwin
|
|
cygwin=
|
|
cygwin=$(uname | sed -ne '/^CYGWIN/p')
|
|
if [ -n "$cygwin" ]; then
|
|
TMPDIR=.
|
|
export TMPDIR
|
|
fi
|
|
|
|
THIS_TEMPDIR=
|
|
THIS_TEMPDIR="$(mktemp -d -t $THIS.XXXXXXXX)" || exit 1
|
|
readonly THIS_TEMPDIR
|
|
|
|
trap 'exitcode=$?
|
|
[ -z "$THIS_TEMPDIR" ] || rm -rf "$THIS_TEMPDIR"
|
|
exit $exitcode' 0 1 2 3 13 15
|