Add test to see if command exists with POSIX 'command'

This commit is contained in:
Apostolis Anastasiou 2023-01-20 03:09:16 +02:00
parent c3085126e4
commit de5c00ac23
No known key found for this signature in database
GPG key ID: FD6B251FBF7F5D03

View file

@ -9,7 +9,13 @@ FORCE_COLOR=1 DEBUG=1 go run ./e2etests/report/main.go "$@";
if [ -z "${NO_OPEN:-}" ]; then if [ -z "${NO_OPEN:-}" ]; then
if [ -s "$REPORT_OUTPUT" ]; then if [ -s "$REPORT_OUTPUT" ]; then
open "$REPORT_OUTPUT" if [ -x "$(command -v open)" ]; then
open $REPORT_OUTPUT
elif [ -x "$(command -v xdg-open)" ]; then
xdg-open $REPORT_OUTPUT
else
echo "Please open $REPORT_OUTPUT"
fi
else else
echo "The report is empty" echo "The report is empty"
fi fi