OXYGENHUB
# d256e826ac5d oxygen / src / main.rs
835 B · Rust · last changed Memory per phase with a counting allocator 1 month ago source blame history raw
1
//! `oxy`: command-line interface for Oxygen.
2
//!
3
//! Command definitions and dispatch live in `cli`; each command group has
4
//! its own module there.
5
6
mod cli;
7
8
#[cfg(feature = "alloc-stats")]
9
#[global_allocator]
10
static ALLOC: oxy_core::alloc_stats::Counting = oxy_core::alloc_stats::Counting;
11
12
fn main() {
13
    // Behave like other CLI tools when output is piped into `head`: die
14
    // quietly on SIGPIPE instead of panicking on a failed write.
15
    #[cfg(unix)]
16
    unsafe {
17
        libc::signal(libc::SIGPIPE, libc::SIG_DFL);
18
    }
19
    let result = cli::run();
20
    oxy_core::timing::memory_summary();
21
    match result {
22
        Ok(code) => std::process::exit(code),
23
        Err(e) => {
24
            cli::ui::init(false);
25
            eprintln!("{} {e:#}", cli::ui::err("error:"));
26
            std::process::exit(1);
27
        }
28
    }
29
}