Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "csm"
version = "0.1.0-alpha3"
version = "0.1.0-alpha4"
edition = "2024"

[lints.clippy]
Expand Down
17 changes: 16 additions & 1 deletion src/micromamba/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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> {
Expand Down
8 changes: 8 additions & 0 deletions src/micromamba/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ impl MicromambaResult {
_ => ExitCode::FAILURE,
}
}

pub fn exit_status(&self) -> Option<ExitStatus> {
match self {
Self::StreamedOutput(exit_status) => Some(*exit_status),
Self::CapturedOutput(output) => Some(output.status),
_ => None,
}
}
}

impl From<MicromambaResult> for Result<(), ExitCode> {
Expand Down