Skip to content

Commit b60d0bf

Browse files
committed
Resolve shellcheck error in test workflow
``` ShellCheck - shell script analysis tool version: 0.9.0 license: GNU General Public License, version 3 website: https://www.shellcheck.net In ./bin/functions line 179: if [ $? -ne 0 ]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. For more information: https://www.shellcheck.net/wiki/SC2181 -- Check exit code directly with e.g... ##[error]Process completed with exit code 1. ```
1 parent 9dcc9e6 commit b60d0bf

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

bin/functions

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,17 @@ function install {
165165
${SHA256SUM} -c <<<"${checksum} ${package_filename}"
166166

167167
case "${package_filename}" in
168-
*zip) unzip "${package_filename}"
169-
;;
170-
*tar.gz) tar xf "${package_filename}"
171-
;;
172-
*tgz) tar xf "${package_filename}"
173-
;;
174-
*) echo "Cannot extract ${package_filename}"
175-
exit 1
176-
;;
177-
esac
178-
179-
if [ $? -ne 0 ]; then
180-
echo "Failed to extract ${package_filename}"
168+
*zip)
169+
unzip "${package_filename}" || { echo "Failed to extract ${package_filename}" >&2; exit 1; }
170+
;;
171+
*tar.gz|*tgz)
172+
tar xf "${package_filename}" || { echo "Failed to extract ${package_filename}" >&2; exit 1; }
173+
;;
174+
*)
175+
echo "Cannot extract ${package_filename}: unsupported file type." >&2
181176
exit 1
182-
fi
177+
;;
178+
esac
183179

184180
read -r -a dirs <<<"$(ls -d ./*/)"
185181
cd "${dirs[0]}" || return 1

0 commit comments

Comments
 (0)