-
-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SystemExt::distribution_id() #844
Conversation
I am working on test failures. |
src/traits.rs
Outdated
/// Returns the distribution id as defined by os-release, | ||
/// or OS-name if unavailable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about:
/// Returns the distribution id as defined by os-release, | |
/// or OS-name if unavailable. | |
/// Returns the distribution id as defined by os-release, | |
/// or [`std::env::consts::OS`]. |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
A few small nits but otherwise looks great! |
41739a4
to
ec1d180
Compare
src/lib.rs
Outdated
@@ -344,6 +344,8 @@ mod test { | |||
.long_os_version() | |||
.expect("Failed to get long OS version") | |||
.is_empty()); | |||
|
|||
assert!(!s.distribution_id().is_empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this test outside of the if System::IS_SUPPORTED
since it can definitely work even on unknown targets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Please take a look if this is what you meant.
For the once_cell failures, don't worry. I think I'll send a PR to update the minimum supported rust version or enforce the usage of a previous one to prevent breaking the CI. Not sure which way is better... |
20d32d6
to
3fe5715
Compare
Thank you for clarification! |
SystemExt::name() returns human-readable distribution name, but there is no machine-readable alternative. SystemExt::distribution_id() returns os-release.ID, or std::env::consts::OS if os-release.ID is unavailable. Fallback behaviour is consistent with the os-release.ID specification on Linux. See also - https://www.freedesktop.org/software/systemd/man/os-release.html#ID= - https://doc.rust-lang.org/std/env/consts/constant.OS.html Closes GuillaumeGomez#843.
3fe5715
to
ceef6b0
Compare
Thanks for adding this feature! I'll make a release not too far in the future. |
SystemExt::name() returns human-readable distribution name, but there is no machine-readable alternative.
SystemExt::distribution_id() returns os-release.ID, or std::env::consts::OS if os-release.ID is unavailable. Fallback behaviour is consistent with the os-release.ID specification on Linux.
See also
Closes #843.