Skip to content

Commit

Permalink
fix(reset): catch grep failure so script doesn't die
Browse files Browse the repository at this point in the history
with -e, the script returns an error code whenever any command does so,
which can cause the rest of the Dev Container setup to fail

grep returns an error code when no match is found, but we don't want
that to end the script in error, so test the grep return code

see https://stackoverflow.com/a/49627999/453168
  • Loading branch information
thekaveman committed Mar 28, 2024
1 parent 23f6b11 commit 05c976b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/reset_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ else
echo "DB_RESET is false, skipping"
fi

valid_fixtures=$(echo "$DJANGO_DB_FIXTURES" | grep -e fixtures\.json$)
valid_fixtures=$(echo "$DJANGO_DB_FIXTURES" | grep -e fixtures\.json$ || test $? = 1)

if [[ -n "$valid_fixtures" ]]; then
# load data fixtures
Expand Down

0 comments on commit 05c976b

Please sign in to comment.