Skip to content

Commit 9157bb7

Browse files
committed
fix(compat): suppress command -v stderr in Bash 3.0
In Bash 3.0, `command -v` prints errors to stderr for missing commands unlike modern bash which is silent. Redirect stderr to /dev/null.
1 parent be1497b commit 9157bb7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/check_os.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ function bashunit::check_os::init() {
2828
}
2929

3030
function bashunit::check_os::is_ubuntu() {
31-
command -v apt >/dev/null
31+
command -v apt >/dev/null 2>&1
3232
}
3333

3434
function bashunit::check_os::is_alpine() {
35-
command -v apk >/dev/null
35+
command -v apk >/dev/null 2>&1
3636
}
3737

3838
function bashunit::check_os::is_nixos() {

0 commit comments

Comments
 (0)