[PATCH] Trapping exit in tests, using return for errors