Skip to content

Commit a3cd404

Browse files
Update scripts/check-build.sh
Co-authored-by: Igor Braga <5835477+bragaigor@users.noreply.github.com>
1 parent a1678f7 commit a3cd404

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/check-build.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,11 @@ fi
200200
# Newer forge versions (> 1.0.0) use solar instead of solc for Yul compilation,
201201
# which causes `make build` to fail.
202202
if command_exists forge; then
203-
FORGE_INSTALLED_VERSION=$(forge --version | head -n 1 | awk '{print $2}')
204-
if compare_versions "$forge_max_version" "$FORGE_INSTALLED_VERSION" "exact"; then
205-
echo -e "${GREEN}forge version $FORGE_INSTALLED_VERSION is installed (compatible).${NC}"
206-
else
203+
FORGE_INSTALLED_VERSION=$(forge --version 2>/dev/null | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)
204+
if [[ -z "$FORGE_INSTALLED_VERSION" ]]; then
205+
echo -e "${RED}Could not parse forge version from \`forge --version\`.${NC}"
206+
EXIT_CODE=1
207+
elif compare_versions "$forge_version_needed" "$FORGE_INSTALLED_VERSION" "exact"; then
207208
echo -e "${RED}forge version $FORGE_INSTALLED_VERSION is not compatible. Version $forge_max_version is required (newer versions use solar instead of solc for Yul compilation). Run: foundryup --version $forge_max_version${NC}"
208209
EXIT_CODE=1
209210
fi

0 commit comments

Comments
 (0)