Skip to content

Commit

Permalink
Merge remote-tracking branch 'lunaetic/sync-cmd-exit-on-error' into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
davidalger committed Mar 1, 2020
2 parents 0d8b0f9 + e2e54cd commit 5157429
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions commands/sync.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,17 @@ case "${WARDEN_PARAMS[0]}" in

## wait for sync session to complete initial sync before exiting
echo "Waiting for initial synchronization to complete"
while ! mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \
| grep -i 'watching for changes'>/dev/null; do printf .; sleep 1; done; echo
while ! mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \
| grep -i 'watching for changes'>/dev/null;
do
if mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \
| grep -i 'Last error' > /dev/null; then
MUTAGEN_ERROR=$(mutagen sync list --label-selector "warden-sync=${WARDEN_ENV_NAME}" \
| sed -n 's/Last error: \(.*\)/\1/p')
>&2 printf "\033[31m\nMutagen encountered an error during sync: ${MUTAGEN_ERROR}\n\033[0m"
exit 1
fi
printf .; sleep 1; done; echo
;;
stop)
## terminate only sessions labeled with this env name
Expand Down

0 comments on commit 5157429

Please sign in to comment.