Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion osinfo/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pub struct OsInfo {
/// Defines the processor architecture as reported by `uname -m` on the operating system.
#[serde(skip_serializing_if = "Option::is_none")]
architecture: Option<String>,
#[serde(rename = "_name", skip_serializing_if = "Option::is_none")]
name: Option<String>,
}

/// Defines whether the operating system is a 32-bit or 64-bit operating system.
Expand Down Expand Up @@ -64,14 +66,22 @@ impl OsInfo {
os_info::Bitness::X64 => Bitness::Bit64,
_ => Bitness::Unknown,
};
let version = os_info.version().to_string();
let name = Some(format!(
"{:?} {} {}",
family,
version,
architecture.as_deref().unwrap_or("")
));
Self {
id: ID.to_string(),
family,
version: os_info.version().to_string(),
version,
edition,
codename,
bitness: bits,
architecture,
name,
}
}
}
1 change: 1 addition & 0 deletions osinfo/tests/osinfo.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ Describe 'osinfo resource tests' {
elseif ($IsMacOS) {
$out.resources[0].properties.family | Should -BeExactly 'macOS'
}
$out.resources[0].name | Should -BeExactly "$($out.resources[0].properties.family) $($out.resources[0].properties.version) $($out.resources[0].properties.architecture)"
}
}
Loading