diff --git a/scripts/binary_check.sh b/scripts/binary_check.sh index 725a058..07fde0e 100755 --- a/scripts/binary_check.sh +++ b/scripts/binary_check.sh @@ -1,11 +1,22 @@ #! /bin/bash -if ! [[ "$(npm list -g huffc)" =~ "empty" ]]; then - # huffc was installed via npm, return 0x00 - echo -n 0x00 -elif [[ "$(yarn global list)" =~ "huffc" ]]; then - # huffc was installed via yarn, return 0x00 - echo -n 0x00 -else - echo -n 0x01 +# Check if npm is installed +if command -v npm &> /dev/null; then + if ! [[ "$(npm list -g huffc)" =~ "empty" ]]; then + # huffc was installed via npm, return 0x00 + echo -n 0x00 + exit 0 + fi fi + +# Check if yarn is installed +if command -v yarn &> /dev/null; then + if [[ "$(yarn global list)" =~ "huffc" ]]; then + # huffc was installed via yarn, return 0x00 + echo -n 0x00 + exit 0 + fi +fi + +# Else, return 0x01 +echo -n 0x01