Skip to main content


In #Rustlang you can return std::process::ExitCode from main().

It's better than calling std::process::exit(), because it allows the program to run destructors, which may be needed to flush pending I/O or print buffered logs.

https://play.rust-lang.org/?gist=56c6ffb9d0b1206502ca996244bd0242

https://doc.rust-lang.org/stable/std/process/struct.ExitCode.html

This entry was edited (7 months ago)