From b217a7a10c9397dc451280bd033589fe08892f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damien=20Nad=C3=A9?= Date: Tue, 8 Sep 2015 16:52:19 +0200 Subject: [PATCH] Redirecting cd stdout to /dev/null to avoid CDPATH noise --- install.sh | 4 ++-- libexec/bats | 8 ++++---- test/bats.bats | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 8bbdd16..2ec5e84 100755 --- a/install.sh +++ b/install.sh @@ -10,13 +10,13 @@ abs_dirname() { local path="$1" while [ -n "$path" ]; do - cd "${path%/*}" + cd "${path%/*}" >/dev/null local name="${path##*/}" path="$(resolve_link "$name" || true)" done pwd - cd "$cwd" + cd "$cwd" >/dev/null } PREFIX="$1" diff --git a/libexec/bats b/libexec/bats index 71f392f..843a045 100755 --- a/libexec/bats +++ b/libexec/bats @@ -35,19 +35,19 @@ abs_dirname() { local path="$1" while [ -n "$path" ]; do - cd "${path%/*}" + cd "${path%/*}" >/dev/null local name="${path##*/}" path="$(resolve_link "$name" || true)" done pwd - cd "$cwd" + cd "$cwd" >/dev/null } expand_path() { - { cd "$(dirname "$1")" 2>/dev/null + { cd "$(dirname "$1")" >/dev/null 2>&1 local dirname="$PWD" - cd "$OLDPWD" + cd "$OLDPWD" >/dev/null echo "$dirname/$(basename "$1")" } || echo "$1" } diff --git a/test/bats.bats b/test/bats.bats index f1aff29..f38d85d 100755 --- a/test/bats.bats +++ b/test/bats.bats @@ -150,7 +150,7 @@ fixtures bats } @test "failing test file outside of BATS_CWD" { - cd "$TMP" + cd "$TMP" >/dev/null run bats "$FIXTURE_ROOT/failing.bats" [ $status -eq 1 ] [ "${lines[2]}" = "# (in test file $FIXTURE_ROOT/failing.bats, line 4)" ]