Skip to content
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

Fix invalid version for os with 0 as patch number #37

Merged
merged 2 commits into from
May 21, 2021

Conversation

nicochatzi
Copy link
Contributor

On macOS 11.1.0 the version number returned by sw_vers -productVersion does not have a patch number, i.e. it returns 11.1. So semver::Version::parse() fails. This PR appends the version number in case it's missing a patch or minor number so that the parsing succeeds.

Copy link
Owner

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for this. If you'd like to also increment the version to 0.4.1 in Cargo.toml I'll do a new release?

Comment on lines 149 to 150
1 => to_semver(&format!("{}.0.0", version_string.trim_end_matches('\n'))),
2 => to_semver(&format!("{}.0", version_string.trim_end_matches('\n'))),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably prefer just trim() here, not going to block on that though. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short and sweet!

@cmyr cmyr merged commit 9011b00 into cmyr:master May 21, 2021
@cmyr
Copy link
Owner

cmyr commented May 21, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants