Ensure process exit code is preserved when using --no-exit

When using --no-exit to wait for the event loop to finish, the exit code gets lost.

This patch ensures that if tests fail, the exit code makes it back to the shell