Improve handling of build failure/cancellation for tests
Improve handling of build failure/cancellation for tests

Previously if `bazel_build.py` was interrupted while it was trying
to acquire the file lock, we would exit with an uncaught
`KeyboardInterrupt` exception which Xcode would show to the user.

That behavior isn't great since it will likely hide the actual error
from the user (e.g. if targets are building in parallel and one of
them fails, Xcode will interrupt us).

PiperOrigin-RevId: 308318638

bazelbuild/tulsi,bazelbuild/tulsi,bazelbuild/tulsi,bazelbuild/tulsi,bazelbuild/tulsi,bazelbuild/tulsi