Terminate nicely from build script?

Is there a way to fail a build script in a "clean" way?

If a build script panics, or in any way terminates with a non-zero exit code, the build is failed, but then the standard out and standard error of the build script (which in my case includes a bunch of cargo:rerun-if-changed lines).

Is there a way to tell cargo "nicely" that the build is failed, so it can display nicely formatted cargo:warning lines while eating other output that was only intended for cargo and not the user anyway?

I don't believe so, panic! is it.

Thanks, maybe I should submit an issue about it.