Skip to content

Commit

Permalink
refactor: change trigger_is_started to be exact
Browse files Browse the repository at this point in the history
  • Loading branch information
vindard committed Dec 23, 2023
1 parent ada3650 commit 0259cbb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions bats/helpers/trigger.bash
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@ trigger_is_stopped() {
}

trigger_is_started() {
local NUM_LINES=18
cat $TILT_LOG_FILE | grep 'api-trigger │' \
| tail -n $NUM_LINES \
| grep "Successfully stopped trigger"
lastLineNum=$(grep -n 'Successfully stopped trigger' "$TILT_LOG_FILE" | tail -1 | cut -d: -f1)
if [[ -z "$lastLineNum" ]]; then lastLineNum=0; fi

if [[ "$?" == "0" ]]; then
return 1
else
return 0
fi
tail -n +$((lastLineNum + 1)) "$TILT_LOG_FILE" | grep -q 'finish updating pending invoices'
return $?
}

0 comments on commit 0259cbb

Please sign in to comment.