Skip to content

Commit 474553b

Browse files
authored
fix: Fix issues with path handling in grep command Update is_contract.sh (#2359)
1 parent b195f58 commit 474553b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

scripts/is_contract.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,14 @@ SOURCE_PATH=$(cargo metadata --format-version=1 --manifest-path "$MANIFEST_PATH"
3434
| select(.id == $ROOT_PACKAGE).targets[]
3535
| select(.kind[] | contains("lib")).src_path')
3636

37-
if grep -q '^#\[ink::contract\([^]]*\)\]' $SOURCE_PATH; then
37+
# Check if SOURCE_PATH is empty
38+
if [ -z "$SOURCE_PATH" ]; then
39+
echo "Error: Source path is empty."
40+
exit 1
41+
fi
42+
43+
# Check for the #[ink::contract] macro in the source file
44+
if grep -q '^#\[ink::contract\([^]]*\)\]' "$SOURCE_PATH"; then
3845
exit 0
3946
else
4047
exit 1

0 commit comments

Comments
 (0)