diff --git a/install.sh b/install.sh index 9d8f0be698..edc26af7ea 100755 --- a/install.sh +++ b/install.sh @@ -24,6 +24,6 @@ install -m 644 "$BATS_ROOT/man/bats.7" "$PREFIX/share/man/man7" read -rd '' BATS_EXE_CONTENTS <"$PREFIX/bin/bats" || true BATS_EXE_CONTENTS=${BATS_EXE_CONTENTS/"BATS_BASE_LIBDIR=lib"/"BATS_BASE_LIBDIR=${LIBDIR}"} -printf "%s" "$BATS_EXE_CONTENTS" > "$PREFIX/bin/bats" +printf "%s" "$BATS_EXE_CONTENTS" >| "$PREFIX/bin/bats" echo "Installed Bats to $PREFIX/bin/bats" diff --git a/libexec/bats-core/bats-exec-test b/libexec/bats-core/bats-exec-test index 2109d3754d..c59010a437 100755 --- a/libexec/bats-core/bats-exec-test +++ b/libexec/bats-core/bats-exec-test @@ -72,7 +72,7 @@ bats_create_test_tmpdirs() { exit 1 fi - printf "%s\n" "$BATS_TEST_NAME" >"$BATS_TEST_TMPDIR.name" + printf "%s\n" "$BATS_TEST_NAME" >> "$BATS_TEST_TMPDIR.name" # append name in case of test retries export BATS_TEST_TMPDIR } diff --git a/libexec/bats-core/bats-gather-tests b/libexec/bats-core/bats-gather-tests index 98189093af..b89936dc23 100755 --- a/libexec/bats-core/bats-gather-tests +++ b/libexec/bats-core/bats-gather-tests @@ -111,7 +111,7 @@ function should_skip_because_of_focus() { focus_mode=1 # ... -> remove previously found, unfocused tests included_tests=() - : > "$TESTS_LIST_FILE" + : >| "$TESTS_LIST_FILE" fi elif [[ $focus_mode == 1 ]]; then # the current test is not focused but focus mode is enabled -> filter out diff --git a/test/fixtures/bats/issue-205.bats b/test/fixtures/bats/issue-205.bats index ddc826a34b..7b48c97959 100644 --- a/test/fixtures/bats/issue-205.bats +++ b/test/fixtures/bats/issue-205.bats @@ -19,7 +19,7 @@ function get_open_fds() { BASHPID=$(bash -c 'echo $PPID') fi local tmpfile - tmpfile=$(mktemp "$BATS_SUITE_TMPDIR/fds-XXXXXX") + tmpfile=$(mktemp -u "$BATS_SUITE_TMPDIR/fds-XXXXXX") # macos requires -u instead of --dry-run # Avoid opening a new fd to read fds: Don't use <(), glob expansion. # Instead, redirect stdout to file which does not create an extra FD. if [[ -d /proc/$BASHPID/fd ]]; then # Linux