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

use shirabe_php_shim::{PHP_ENV, PHP_SERVER};

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());
    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);
}