maint/util ~ fix shellcheck complaints

This commit is contained in:
Roy Ivy III 2022-02-06 17:01:50 -06:00
parent fdd11e0637
commit a970c8d45d
2 changed files with 16 additions and 1 deletions

View file

@ -56,4 +56,5 @@ if genhtml --version 2>/dev/null 1>&2; then
else
grcov . --output-type html --output-path "${COVERAGE_REPORT_DIR}" --branch --ignore build.rs --ignore '/*' --ignore '[A-Za-z]:/*' --ignore 'C:/Users/*' --excl-br-line '^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()'
fi
# shellcheck disable=SC2181
if [ $? -ne 0 ]; then exit 1; fi

View file

@ -9,7 +9,21 @@ export COVERAGE_REPORT_DIR="${REPO_main_dir}/target/debug/coverage-nix"
if ! "${ME_dir}/build-code_coverage.sh"; then exit 1; fi
case ";$OSID_tags;" in
# WSL?
if [ -z "${OSID_tags}" ]; then
if [ -e '/proc/sys/fs/binfmt_misc/WSLInterop' ] && (grep '^enabled$' '/proc/sys/fs/binfmt_misc/WSLInterop' >/dev/null); then
__="wsl"
case ";${OSID_tags};" in ";;") OSID_tags="$__" ;; *";$__;"*) ;; *) OSID_tags="$__;$OSID_tags" ;; esac
unset __
# Windows version == <major>.<minor>.<build>.<revision>
# Release ID; see [Release ID/Version vs Build](https://winreleaseinfoprod.blob.core.windows.net/winreleaseinfoprod/en-US.html)[`@`](https://archive.is/GOj1g)
OSID_wsl_build="$(uname -r | sed 's/^[0-9.][0-9.]*-\([0-9][0-9]*\)-.*$/\1/g')"
OSID_wsl_revision="$(uname -v | sed 's/^#\([0-9.][0-9.]*\)-.*$/\1/g')"
export OSID_wsl_build OSID_wsl_revision
fi
fi
case ";${OSID_tags};" in
*";wsl;"*) powershell.exe -c "$(wslpath -w "${COVERAGE_REPORT_DIR}"/index.html)" ;;
*) xdg-open --version >/dev/null 2>&1 && xdg-open "${COVERAGE_REPORT_DIR}"/index.html || echo "report available at '\"${COVERAGE_REPORT_DIR}\"/index.html'" ;;
esac