mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-17 03:40:23 +03:00
fix(cli/info): fix crash when checking node version (#9412)
closes #9396
This commit is contained in:
parent
cd23bb2ca2
commit
9331435a50
6
.changes/tauri-info-no-node.md
Normal file
6
.changes/tauri-info-no-node.md
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"tauri-cli": "patch:bug"
|
||||||
|
"@tauri-apps/cli": "patch:bug"
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix `tauri info` crashing when Node.js is not installed.
|
@ -42,17 +42,17 @@ pub fn items(metadata: &VersionMetadata) -> Vec<SectionItem> {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.trim();
|
.trim();
|
||||||
ActionResult::Description(format!("node: {}{}", v, {
|
ActionResult::Description(format!("node: {}{}", v, {
|
||||||
let version = semver::Version::parse(v).unwrap();
|
let version = semver::Version::parse(v);
|
||||||
let target_version = semver::Version::parse(node_target_ver.as_str()).unwrap();
|
let target_version = semver::Version::parse(node_target_ver.as_str());
|
||||||
if version < target_version {
|
match (version, target_version) {
|
||||||
format!(
|
(Ok(version), Ok(target_version)) if version < target_version => {
|
||||||
" ({}, latest: {})",
|
format!(
|
||||||
"outdated".red(),
|
" ({}, latest: {})",
|
||||||
target_version.to_string().green()
|
"outdated".red(),
|
||||||
)
|
target_version.to_string().green()
|
||||||
} else {
|
)
|
||||||
"".into()
|
}
|
||||||
}
|
_ => "".into(),
|
||||||
}))
|
}))
|
||||||
} else {
|
} else {
|
||||||
ActionResult::None
|
ActionResult::None
|
||||||
|
Loading…
Reference in New Issue
Block a user