diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-27 06:09:23 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-27 06:09:23 +0900 |
| commit | 5c2c72223cb6b4d77a332eeeeff7ee4e82e3f239 (patch) | |
| tree | 5c361789cd0a15ed3996068b3dd76f2a5689ce9b /crates/shirabe | |
| parent | 7e53721b8006752e9579126f0536abb7fbcc0d17 (diff) | |
| download | php-shirabe-5c2c72223cb6b4d77a332eeeeff7ee4e82e3f239.tar.gz php-shirabe-5c2c72223cb6b4d77a332eeeeff7ee4e82e3f239.tar.zst php-shirabe-5c2c72223cb6b4d77a332eeeeff7ee4e82e3f239.zip | |
refactor(main): minor refactoring
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/lib.rs | 5 | ||||
| -rw-r--r-- | crates/shirabe/src/main.rs | 7 |
2 files changed, 4 insertions, 8 deletions
diff --git a/crates/shirabe/src/lib.rs b/crates/shirabe/src/lib.rs index 7c4fc96..2db47fc 100644 --- a/crates/shirabe/src/lib.rs +++ b/crates/shirabe/src/lib.rs @@ -25,11 +25,11 @@ pub mod script; pub mod self_update; pub mod util; +/// ref: composer/bin/composer pub fn run(argv: Vec<String>) -> anyhow::Result<i32> { use crate::console::ApplicationHandle; use crate::util::Platform; use shirabe_external_packages::symfony::console::input::argv_input::ArgvInput; - use shirabe_external_packages::symfony::console::input::input_interface::InputInterface; // TODO(php-runtime): the full initialization process in composer/bin/composer should be ported // somewhere else that communicates with the real PHP runtime. @@ -40,8 +40,7 @@ pub fn run(argv: Vec<String>) -> anyhow::Result<i32> { ); let application = ApplicationHandle::new("Composer".to_string(), String::new())?; - let input = std::rc::Rc::new(std::cell::RefCell::new(ArgvInput::new(Some(argv), None)?)) - as std::rc::Rc<std::cell::RefCell<dyn InputInterface>>; + let input = std::rc::Rc::new(std::cell::RefCell::new(ArgvInput::new(Some(argv), None)?)); application.run(Some(input), None) } diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs index e3cb963..8e8e329 100644 --- a/crates/shirabe/src/main.rs +++ b/crates/shirabe/src/main.rs @@ -9,15 +9,12 @@ fn main() { std::sync::LazyLock::force(&PHP_SERVER); let result = shirabe::run(std::env::args().collect()); - let mut exit_code = match result { + let 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); + std::process::exit(exit_code.min(255)); } |
