Skip to content

Commit

Permalink
fix: issues due to noclobber
Browse files Browse the repository at this point in the history
  • Loading branch information
martin-schulze-vireso committed Dec 20, 2024
1 parent 21e9f4e commit 4018d63
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion libexec/bats-core/bats-exec-test
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion libexec/bats-core/bats-gather-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/bats/issue-205.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 --dry-run "$BATS_SUITE_TMPDIR/fds-XXXXXX")
# 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
Expand Down

0 comments on commit 4018d63

Please sign in to comment.