mirror of
https://github.com/sstephenson/bats.git
synced 2024-11-17 11:42:33 +01:00
Safe-guard for rm -f /*
While looking at the source, I've seen this and imagined what might happen if some test causes unsetting of $TMP, or if the setup method would not be called for some reason. As a sidenote, I've wondered why BATS_TMPDIR is not used here.
This commit is contained in:
parent
2476770c84
commit
9e3972e7e7
|
@ -7,5 +7,7 @@ setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
|
# Safe guard, if $TMP might end up empty!
|
||||||
|
[[ -d "$TMP" ]] || { echo "FATAL: \$TMP is not a directory in teardown."; exit 1; }
|
||||||
rm -f "$TMP"/*
|
rm -f "$TMP"/*
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user