F.e. when I cancel
git push, how can I make sure that
mix test, triggered by below
pre-push hook, gets cancelled as well.
cd `git rev-parse --show-toplevel` echo "Testing..." >&2 mix test 2>&1 >/dev/null if [ $? != 0 ]; then echo "Push rejected: tests failed" >&2 exit 1 fi echo "Tests passed"
What unfortunately happens after
git push is cancelled, is that above
mix test spams the terminal window with test-logs. The
"Push rejected: tests failed" from the above hook gets printed as well.
Test commands in other ecosystems, in the identical environment (Zsh version, etc.) with only
mix test command above being replaced with for example
RAILS_ENV=test bundle exec rspec spec # or node_modules/.bin/jest --config ./tests/jest-config.js
seem to get cancelled - or at least they don’t echo back into terminal from where the
git push was attempted (and cancelled).