--- libexec/bats-core/bats +++ libexec/bats-core/bats @@ -128,9 +128,11 @@ export BATS_LINE_REFERENCE_FORMAT=${BATS_LINE_REFERENCE_FORMAT-comma_line} if [[ ! -d "${BATS_TMPDIR}" ]]; then printf "Error: BATS_TMPDIR (%s) does not exist or is not a directory" "${BATS_TMPDIR}" >&2 exit 1 -elif [[ ! -w "${BATS_TMPDIR}" ]]; then +elif ! touch "${BATS_TMPDIR}/.bats_tmp_test_$$" 2>/dev/null; then printf "Error: BATS_TMPDIR (%s) is not writable" "${BATS_TMPDIR}" >&2 exit 1 +else + rm -f "${BATS_TMPDIR}/.bats_tmp_test_$$" fi arguments=()