aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-23 01:11:39 +0900
committernsfisis <nsfisis@gmail.com>2026-02-23 01:57:21 +0900
commit9e1cc460be145dfe33a5f8d23bd9559ed4adaf26 (patch)
tree3afdee2aceac2b62f2ddf65f2fb71d50ce97c341 /crates
parente532af7ea66f7245725feb3eb515cc467b23c405 (diff)
downloadphp-mozart-9e1cc460be145dfe33a5f8d23bd9559ed4adaf26.tar.gz
php-mozart-9e1cc460be145dfe33a5f8d23bd9559ed4adaf26.tar.zst
php-mozart-9e1cc460be145dfe33a5f8d23bd9559ed4adaf26.zip
fix(diagnose): use bail_silent for exit code and add git color.ui check
Replace std::process::exit() with bail_silent() so Rust cleanup and Drop handlers run properly on non-zero exit. Add a check for git color.ui=always which is known to cause issues with git output parsing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/mozart/src/commands/diagnose.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/mozart/src/commands/diagnose.rs b/crates/mozart/src/commands/diagnose.rs
index dc1ea85..0c027d7 100644
--- a/crates/mozart/src/commands/diagnose.rs
+++ b/crates/mozart/src/commands/diagnose.rs
@@ -251,6 +251,21 @@ fn check_git() -> CheckResult {
return CheckResult::Warning("git --version returned a non-zero exit code".to_string());
}
+ // Check color.ui setting before parsing the version
+ if let Ok(color_output) = std::process::Command::new("git")
+ .args(["config", "color.ui"])
+ .output()
+ {
+ let color_val = String::from_utf8_lossy(&color_output.stdout);
+ if color_val.trim().eq_ignore_ascii_case("always") {
+ return CheckResult::Warning(
+ "Your git color.ui setting is set to always, this is known to create issues. \
+ Use \"git config --global color.ui true\" to set it correctly."
+ .to_string(),
+ );
+ }
+ }
+
let stdout = String::from_utf8_lossy(&output.stdout);
let version_str = stdout.trim();
@@ -470,7 +485,7 @@ pub async fn execute(
}
if exit_code != 0 {
- std::process::exit(exit_code);
+ return Err(mozart_core::exit_code::bail_silent(exit_code));
}
Ok(())
}