Use set -e and trap rather than "successfully"

Behavior should be identical. set -e will cause any failing command to
exit and the trap will output "failed" on stderr, like successfully used
to.