diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-06-19 23:00:38 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-06-19 23:00:38 +0900 |
| commit | adfa7c6b295521a6f8fdf4084993a80a8030e49b (patch) | |
| tree | 36d2bc1f717286d129bc7f15fba2d06e6887ad5f /crates/shirabe/src/main.rs | |
| parent | fd733a87364b877d5e66b4973bd61b5379ec4d61 (diff) | |
| download | php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.tar.gz php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.tar.zst php-shirabe-adfa7c6b295521a6f8fdf4084993a80a8030e49b.zip | |
test(command): add basic smoke tests
Diffstat (limited to 'crates/shirabe/src/main.rs')
| -rw-r--r-- | crates/shirabe/src/main.rs | 29 |
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); } |
