chore: update std::process::exit(0) calls in ProjectCompiler::compile by Pronoss · Pull Request #10328 · foundry-rs/foundry (original) (raw)

@grandizzy

After some investigation, I've decided to revert the change and keep the original std::process::exit(0) call.

While avoiding exit(0) would be more idiomatic in Rust, replacing it with a return value like Ok(ProjectCompileOutput::default()) isn't currently feasible without introducing a Default bound on C::Language, which breaks compatibility with downstream code (e.g., foundry-cli fails to compile with E0277).

I explored alternative approaches, including returning an Option or a custom Err, but they would require a wider refactor across the entire call chain. Given that, I've opted to keep the current behavior and leave a // TODO: Avoid process::exit(0) comment in the code for future cleanup when a broader change is more appropriate.

Should I add a more detailed comment in the code next to the exit(0) explaining these issues?