Skip to content
Merged
Changes from all commits
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
7 changes: 5 additions & 2 deletions rust/vm-package-manager/src/links/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use rayon::prelude::*;
use regex::Regex;
use std::collections::HashSet;
use std::process::Command;
use std::sync::OnceLock;
use vm_core::error::{Result, VmError};
use vm_core::vm_error;

Expand Down Expand Up @@ -46,8 +47,10 @@ fn parse_cargo_install_list(output: &str) -> Result<Vec<(String, String)>> {

// Regex to match cargo install list format:
// package_name v1.0.0 (/path/to/source):
let re = Regex::new(r"^([a-zA-Z0-9_-]+)\s+[^\(]*\(([^)]+)\):$")
.map_err(|e| VmError::Internal(format!("Failed to compile regex: {e}")))?;
static RE: OnceLock<Regex> = OnceLock::new();
let re = RE.get_or_init(|| {
Regex::new(r"^([a-zA-Z0-9_-]+)\s+[^\(]*\(([^)]+)\):$").expect("Failed to compile regex")
});

for line in output.lines() {
if let Some(captures) = re.captures(line) {
Expand Down
Loading