logo

utils-std

Collection of commonly available Unix tools
commit: 688e5501d5277a0f2dc5ef4e34ec883ff1d4ae74
parent 3c8f7cfac8d96bf51d8caaa445ebd95a54fd85bc
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Mon,  8 Jul 2024 17:21:59 +0200

test-cmd/pwd: Skip enoent case when mktemp(1) is unavailable

Diffstat:

Mtest-cmd/pwd.sh17+++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/test-cmd/pwd.sh b/test-cmd/pwd.sh @@ -13,10 +13,15 @@ t noargs '' "${PWD?} t --exit=1 usage '-H' 'usage: pwd ' -tmpdir="$(mktemp -d)" || exit 1 -test -d "$tmpdir" || exit 1 -cd "$tmpdir" || exit 1 -rm -fr "$tmpdir" || exit 1 -t --exit=1 enoent '' 'pwd: getcwd: No such file or directory +if command -v mktemp >/dev/null 2>/dev/null +then + tmpdir="$(mktemp -d)" || exit 1 + test -d "$tmpdir" || exit 1 + cd "$tmpdir" || exit 1 + rm -fr "$tmpdir" || exit 1 + t --exit=1 enoent '' 'pwd: getcwd: No such file or directory ' -cd ~- + cd ~- +else + skip enoent 'requires mktemp(1)' +fi