don't run extra logic in zig-cc script if there's no version string in SPC_TARGET

This commit is contained in:
DubbleClick
2025-07-03 14:46:07 +07:00
parent 3444e308fd
commit e5c5b77a9a
2 changed files with 16 additions and 12 deletions

View File

@@ -28,18 +28,20 @@ done
[[ -n "$SPC_TARGET" ]] && TARGET="-target $SPC_TARGET" || TARGET=""
output=$(zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
status=$?
if [[ "$SPC_TARGET" =~ \.[0-9]+\.[0-9]+ ]]; then
output=$(zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}" 2>&1)
status=$?
if [[ $status -eq 0 ]]; then
echo "$output"
exit 0
fi
if [[ $status -eq 0 ]]; then
echo "$output"
exit 0
fi
if echo "$output" | grep -qE "version '.*' in target triple"; then
filtered_output=$(echo "$output" | grep -vE "version '.*' in target triple")
echo "$filtered_output"
exit 0
if echo "$output" | grep -qE "version '.*' in target triple"; then
filtered_output=$(echo "$output" | grep -vE "version '.*' in target triple")
echo "$filtered_output"
exit 0
fi
fi
exec zig cc $TARGET $COMPILER_EXTRA "${PARSED_ARGS[@]}"