Mapping returned `Result` of main to an exit code?
⚓ Rust 📅 2025-05-25 👤 surdeus 👁️ 10The signature of my main function is fn main()->Result<(), Box<dyn std::error::Error>>.
However for different returned Errors, the exit code are all 1. And for Ok(()), the exit code is surely 0.
I know that there IS a method that can do this mapping, based on std::process::exit.
But is there a better way to do this?
2 posts - 2 participants
🏷️ rust_feed