Skip to content

Commit

Permalink
feat: handle symlinks in ignored objects
Browse files Browse the repository at this point in the history
  • Loading branch information
art049 committed Feb 22, 2024
1 parent c28f2ca commit 75dbfa2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/runner/helpers/ignored_objects_path.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::prelude::*;
use std::process::Command;
use std::{path::PathBuf, process::Command};

fn get_python_objects() -> Vec<String> {
let output = Command::new("python")
Expand Down Expand Up @@ -40,10 +40,22 @@ fn get_node_objects() -> Vec<String> {
vec![so_output]
}

fn normalize_objects_path(objects_path_to_ignore: &mut [String]) {
for path in objects_path_to_ignore.iter_mut() {
let cpath = PathBuf::from(&path).canonicalize();
if cpath.is_err() {
debug!("Failed to get normalized shared objects: {:?}", cpath.err());
continue;
}
*path = cpath.unwrap().to_string_lossy().to_string();
}
}

pub fn get_objects_path_to_ignore() -> Vec<String> {
let mut objects_path_to_ignore = vec![];
objects_path_to_ignore.extend(get_python_objects());
objects_path_to_ignore.extend(get_node_objects());
normalize_objects_path(&mut objects_path_to_ignore);
debug!("objects_path_to_ignore: {:?}", objects_path_to_ignore);
objects_path_to_ignore
}

0 comments on commit 75dbfa2

Please sign in to comment.