From 10ede621eb4ec052e51f97eb18e1bed573729204 Mon Sep 17 00:00:00 2001 From: Marco Lopes Date: Thu, 15 Jun 2017 19:12:37 +0100 Subject: [PATCH] Pass different parameters to mktemp on OSX --- src/temp.bash | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/temp.bash b/src/temp.bash index 1361836..c9c53ba 100644 --- a/src/temp.bash +++ b/src/temp.bash @@ -99,7 +99,13 @@ temp_make() { template+='-XXXXXXXXXX' local path - path="$(mktemp --directory --tmpdir="$BATS_TMPDIR" -- "$template" 2>&1)" + + if [ "$(uname -s)" == "Darwin" ]; then + path="$(mktemp -d -- "${BATS_TMPDIR}${template}" 2>&1)" + else + path="$(mktemp -d --tmpdir="$BATS_TMPDIR" -- "$template" 2>&1)" + fi + if (( $? )); then echo "$path" \ | batslib_decorate 'ERROR: temp_make' \