From ee8bc39e3fe751b62ed879b45dc249e4e1ecf3b5 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Mon, 24 Nov 2025 16:34:49 +0100 Subject: [PATCH 1/2] Windows: Try to give a nicer error if missing VC++ Without the redistributable libs, micromamba can't run. Tell the user where to get it. --- src/micromamba/mod.rs | 17 ++++++++++++++++- src/micromamba/result.rs | 8 ++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/micromamba/mod.rs b/src/micromamba/mod.rs index 91ae5c3..e141510 100644 --- a/src/micromamba/mod.rs +++ b/src/micromamba/mod.rs @@ -39,7 +39,7 @@ fn block_on_child_exit(child: &mut std::process::Child) -> MicromambaResult { } fn exec_micromamba(cmd: &mut Command, stream_output: bool) -> MicromambaResult { - if stream_output { + let result = if stream_output { match cmd.spawn() { Ok(mut child) => block_on_child_exit(&mut child), Err(e) if e.kind() == io::ErrorKind::NotFound => { @@ -65,7 +65,22 @@ fn exec_micromamba(cmd: &mut Command, stream_output: bool) -> MicromambaResult { MicromambaResult::CouldNotRun } } + }; + + if cfg!(windows) + && result + .exit_status() + .and_then(|s| s.code()) + .is_some_and(|s| s == 0xc0000135u32 as i32) + { + error!("Windows reported a missing DLL required to run micromamba"); + error!("This error can very likely be solved by installing the VC++ runtime libraries"); + error!( + "See https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-supported-redistributable-version for more information" + ); } + + result } impl<'a> Micromamba<'a> { diff --git a/src/micromamba/result.rs b/src/micromamba/result.rs index 91048d7..f692def 100644 --- a/src/micromamba/result.rs +++ b/src/micromamba/result.rs @@ -39,6 +39,14 @@ impl MicromambaResult { _ => ExitCode::FAILURE, } } + + pub fn exit_status(&self) -> Option { + match self { + Self::StreamedOutput(exit_status) => Some(*exit_status), + Self::CapturedOutput(output) => Some(output.status), + _ => None, + } + } } impl From for Result<(), ExitCode> { From 898a7cd8beeb4e9d8a6aada711c5e0a763783847 Mon Sep 17 00:00:00 2001 From: Rick Elrod Date: Mon, 24 Nov 2025 16:36:17 +0100 Subject: [PATCH 2/2] Bump to alpha4 Signed-off-by: Rick Elrod --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c322c4e..4820dab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -269,7 +269,7 @@ dependencies = [ [[package]] name = "csm" -version = "0.1.0-alpha3" +version = "0.1.0-alpha4" dependencies = [ "assert_cmd", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index 0fe19fc..f566e89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "csm" -version = "0.1.0-alpha3" +version = "0.1.0-alpha4" edition = "2024" [lints.clippy]