Skip to content

Commit 2d0d448

Browse files
committed
error handle
Signed-off-by: Yanxuan Liu <[email protected]>
1 parent 13e8592 commit 2d0d448

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

shell-check/action.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ runs:
9090
9191
# Check if file exists
9292
# Run bash -n syntax check
93-
if ! bash -n "$FILE" 2>&1 | tee -a "$tmp_error"; then
94-
echo "❌ bash -n failed for $FILE" | tee -a "$tmp_error"
95-
((error_count++))
96-
fi
93+
bash -n "$FILE" > >(tee -a "$tmp_error") 2>&1 || {
94+
echo "❌ bash -n failed for $FILE" | tee -a "$tmp_error"
95+
((error_count++))
96+
}
9797
9898
# Run shellcheck
99-
if ! shellcheck --format=tty --color=always "$FILE" 2>&1 | tee -a "$tmp_error"; then
100-
echo "❌ shellcheck failed for $FILE" | tee -a "$tmp_error"
101-
((error_count++))
102-
fi
99+
shellcheck --color=always "$FILE" > >(tee -a "$tmp_error") 2>&1 || {
100+
echo "❌ shellcheck failed for $FILE" | tee -a "$tmp_error"
101+
((error_count++))
102+
}
103103
104104
# If errors were found, add to main log
105105
if [ -s "$tmp_error" ]; then

0 commit comments

Comments
 (0)