aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--crates/shirabe/src/lib.rs5
-rw-r--r--crates/shirabe/src/main.rs7
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));
}