just strip out the error and return the output instead of executing again without version

This commit is contained in:
DubbleClick 2025-06-29 00:06:40 +07:00
parent 19ddddf618
commit d588e6e4fd

View File

@ -72,21 +72,13 @@ else
status=$? status=$?
if [ $status -eq 0 ]; then if [ $status -eq 0 ]; then
echo "$output" | grep -v "version '.*' in target triple" echo "$output"
exit 0 exit 0
fi fi
if echo "$output" | grep -q "version '.*' in target triple"; then if echo "$output" | grep -q "version '.*' in target triple"; then
TARGET_FALLBACK="${SPC_TARGET}-${SPC_LIBC}" echo "$output" | grep -v "version '.*' in target triple"
output=$(zig cc -target "$TARGET_FALLBACK" -lstdc++ ${COMPILER_EXTRA} "${PARSED_ARGS[@]}" 2>&1) exit 0
status=$?
if [ $status -eq 0 ]; then
echo "$output"
exit 0
else
exec zig cc -target "$TARGET_FALLBACK" ${COMPILER_EXTRA} "${PARSED_ARGS[@]}"
fi
else else
exec zig cc -target "$TARGET" ${COMPILER_EXTRA} "${PARSED_ARGS[@]}" exec zig cc -target "$TARGET" ${COMPILER_EXTRA} "${PARSED_ARGS[@]}"
fi fi