Handle format change in asdf version (#1127)
As of the latest version, this now has the format 0.16.7 - i.e. without the hash part. This commit makes it so that both formats work. Fixes #1096
This commit is contained in:
@@ -642,14 +642,17 @@ pub fn run_asdf(ctx: &ExecutionContext) -> Result<()> {
|
|||||||
// v0.15.0-31e8c93
|
// v0.15.0-31e8c93
|
||||||
//
|
//
|
||||||
// ```
|
// ```
|
||||||
|
// ```
|
||||||
|
// $ asdf version
|
||||||
|
// v0.16.7
|
||||||
|
// ```
|
||||||
let version_stdout = version_output.stdout.trim();
|
let version_stdout = version_output.stdout.trim();
|
||||||
// trim the starting 'v'
|
// trim the starting 'v'
|
||||||
let mut remaining = version_stdout.trim_start_matches('v');
|
let mut remaining = version_stdout.trim_start_matches('v');
|
||||||
let idx = remaining
|
// remove the hash part if present
|
||||||
.find('-')
|
if let Some(idx) = remaining.find('-') {
|
||||||
.ok_or_else(|| eyre!(output_changed_message!("asdf version", "no dash (-) found")))?;
|
|
||||||
// remove the hash part
|
|
||||||
remaining = &remaining[..idx];
|
remaining = &remaining[..idx];
|
||||||
|
}
|
||||||
let version =
|
let version =
|
||||||
Version::parse(remaining).wrap_err_with(|| output_changed_message!("asdf version", "invalid version"))?;
|
Version::parse(remaining).wrap_err_with(|| output_changed_message!("asdf version", "invalid version"))?;
|
||||||
if version < Version::new(0, 15, 0) {
|
if version < Version::new(0, 15, 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user