Work around non-failure "failure" modes

This commit is contained in:
Michael Wolf
2023-09-30 17:29:22 -06:00
parent 83f4e1c3e6
commit 1114130e5e

View File

@@ -31,16 +31,18 @@ if [[ $file_type = "javascript" ||
$file_type == "css" || $file_type == "css" ||
$file_type == "scss" || $file_type == "scss" ||
$file_type = "sh" ]]; then $file_type = "sh" ]]; then
out=$("$(wfroot "$DIR")"/./prettier.sh "$file" 2>&1 > /dev/null) set +e
out=$("$WF_ROOT"/./prettier.sh "$file" 2>&1 >/dev/null) out=$("$WF_ROOT"/./prettier.sh "$file" 2>&1 >/dev/null)
retval="$?" retval="$?"
set -e
success_retval=0 success_retval=0
would_reformat_retval=1 would_reformat_retval=1
syntax_error_retval=2 syntax_error_retval=2
elif [[ $file_type == "python" ]]; then elif [[ $file_type == "python" ]]; then
out=$("$(wfroot "$DIR")"/./isort-and-black.sh "$file" 2>&1 > /dev/null) set +e
out=$("$WF_ROOT"/./isort-and-black.sh "$file" 2>&1 >/dev/null) out=$("$WF_ROOT"/./isort-and-black.sh "$file" 2>&1 >/dev/null)
retval="$?" retval="$?"
set -e
success_retval=0 success_retval=0
would_reformat_retval=1 would_reformat_retval=1
syntax_error_retval=2 syntax_error_retval=2
@@ -49,8 +51,10 @@ elif [[ $file_type == "golang" ]] ; then
would_reformat_retval=1 would_reformat_retval=1
syntax_error_retval=2 syntax_error_retval=2
set +e
out=$(gofmt -l "$file") out=$(gofmt -l "$file")
exitval="$?" exitval="$?"
set -e
if [[ "$exitval" = "$syntax_error_retval" ]] ; then if [[ "$exitval" = "$syntax_error_retval" ]] ; then
retval="$exitval" retval="$exitval"
@@ -66,8 +70,11 @@ elif [[ $file_type == "dart" ]] ; then
# probably others too :( # probably others too :(
syntax_error_retval=65 syntax_error_retval=65
set +e
out=$(dart format -o none --set-exit-if-changed "$file") out=$(dart format -o none --set-exit-if-changed "$file")
exitval="$?" exitval="$?"
set -e
retval="$exitval" retval="$exitval"
else else
echo -n "ignoring" echo -n "ignoring"