aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/main.rs
blob: 538d89d0a2f4d7d54afdff630e51ac996a397c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! ref: composer/bin/composer

use shirabe_php_shim::{PHP_ENV, PHP_SERVER, run_shutdown_functions};

fn main() {
    // Take the $_ENV / $_SERVER snapshots before any putenv() mutates the real environment.
    // See `docs/dev/env-vars-porting.md` for details.
    std::sync::LazyLock::force(&PHP_ENV);
    std::sync::LazyLock::force(&PHP_SERVER);

    let result = shirabe::run(std::env::args().collect());
    run_shutdown_functions();
    let mut exit_code = match result {
        Ok(exit_code) => exit_code,
        Err(e) => {
            eprintln!("{}", e);
            1
        }
    };
    if exit_code > 255 {
        exit_code = 255;
    }
    std::process::exit(exit_code);
}