Compare this with Rust, where the usual hello world will just do the right thing:
$ cat > a.rs
fn main() {
println!("Hello World");
}
$ rustc a.rs
$ ./a
Hello World
$ echo $?
0
$ ./a > /dev/full
thread 'main' panicked at 'failed printing to stdout: No space left on device (os error 28)', library/std/src/io/stdio.rs:1187:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
$ echo $?
101