Skip to content

Commit

Permalink
Prefix distro version with "unknown" if distro name is not known
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay authored and GuillaumeGomez committed Dec 27, 2024
1 parent aba59cf commit 1c90820
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/unix/linux/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,16 +395,17 @@ impl SystemInner {

let distro_name = Self::name();
let distro_version = Self::os_version();
if let (Some(distro_name), Some(distro_version)) = (&distro_name, &distro_version) {
if let Some(distro_version) = &distro_version {
// "Linux (Ubuntu 24.04)"
long_name.push_str(" (");
long_name.push_str(distro_name);
long_name.push_str(distro_name.as_deref().unwrap_or("unknown"));
long_name.push(' ');
long_name.push_str(distro_version);
long_name.push(')');
} else if let Some(distro_or_version) = distro_name.or(distro_version) {
} else if let Some(distro_name) = &distro_name {
// "Linux (Ubuntu)"
long_name.push_str(" (");
long_name.push_str(&distro_or_version);
long_name.push_str(distro_name);
long_name.push(')');
}

Expand Down

0 comments on commit 1c90820

Please sign in to comment.