aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe/src/main.rs')
-rw-r--r--crates/shirabe/src/main.rs29
1 files changed, 9 insertions, 20 deletions
diff --git a/crates/shirabe/src/main.rs b/crates/shirabe/src/main.rs
index f179c52..3e3623d 100644
--- a/crates/shirabe/src/main.rs
+++ b/crates/shirabe/src/main.rs
@@ -1,30 +1,19 @@
//! ref: composer/bin/composer
-use shirabe::console::Application;
-use shirabe::util::Platform;
-use shirabe_php_shim::{realpath, run_shutdown_functions};
+use shirabe_php_shim::run_shutdown_functions;
fn main() {
- // TODO(php-runtime): the full initialization process in composer/bin/composer should be ported
- // somewhere else that communicates with the real PHP runtime.
-
- Platform::put_env(
- "COMPOSER_BINARY",
- &realpath(&std::env::args().next().unwrap_or_default()).unwrap_or_default(),
- );
-
- // run the command application
- let application = match Application::new_shared("Composer".to_string(), String::new()) {
- Ok(application) => application,
+ 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);
- std::process::exit(1);
+ 1
}
};
- let result = Application::run(&application, None, None);
- run_shutdown_functions();
- if let Err(e) = result {
- eprintln!("{}", e);
- std::process::exit(1);
+ if exit_code > 255 {
+ exit_code = 255;
}
+ std::process::exit(exit_code);
}