| 1 | #[global_allocator] |
| 2 | static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; |
| 3 | |
| 4 | fn main() -> std::process::ExitCode { |
| 5 | // Reset SIGPIPE to SIG_DFL so piping codewhale output into a command that |
| 6 | // exits early (e.g. `codewhale doctor | head`) terminates the process |
| 7 | // cleanly with exit code 141 instead of panicking on the broken-pipe |
| 8 | // write. Many execution environments (systemd, Docker, some shells) |
| 9 | // inherit SIGPIPE set to SIG_IGN, which makes write(2) return EPIPE; |
| 10 | // Rust's `println!` then treats that io::Error as fatal and panics. |
| 11 | // See issue #4030. |
| 12 | #[cfg(unix)] |
| 13 | unsafe { |
| 14 | libc::signal(libc::SIGPIPE, libc::SIG_DFL); |
| 15 | } |
| 16 | |
| 17 | codewhale_cli::run_cli() |
| 18 | } |
| 19 |