debug: Add extensive logging to binary path resolution
Added eprintln debug statements to trace: - PATH environment variable contents - Each directory being considered - Priority assigned to each path - All candidates after sorting - Final selected path This will help diagnose why Homebrew paths aren't being selected on macOS M4. Debug output goes to stderr which Zed captures in logs.
This commit is contained in:
@@ -284,6 +284,10 @@ fn resolve_binary_path(explicit_path: &Option<String>) -> Result<String> {
|
|||||||
// Collect all candidate paths from PATH, then prioritize them
|
// Collect all candidate paths from PATH, then prioritize them
|
||||||
let mut candidates = Vec::new();
|
let mut candidates = Vec::new();
|
||||||
|
|
||||||
|
// DEBUG: Log PATH directories being considered
|
||||||
|
eprintln!("[TENDRIL DEBUG] PATH environment variable: {}", path_env);
|
||||||
|
eprintln!("[TENDRIL DEBUG] Searching for binaries: {:?}", binary_names);
|
||||||
|
|
||||||
// Parse PATH and collect all plausible paths
|
// Parse PATH and collect all plausible paths
|
||||||
for path_dir in path_env.split(':') {
|
for path_dir in path_env.split(':') {
|
||||||
for binary_name in &binary_names {
|
for binary_name in &binary_names {
|
||||||
@@ -291,16 +295,37 @@ fn resolve_binary_path(explicit_path: &Option<String>) -> Result<String> {
|
|||||||
|
|
||||||
// Categorize by priority (lower number = higher priority)
|
// Categorize by priority (lower number = higher priority)
|
||||||
let priority = if path_dir.contains("/opt/homebrew/bin") {
|
let priority = if path_dir.contains("/opt/homebrew/bin") {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Found Homebrew path (priority 1): {}",
|
||||||
|
full_path
|
||||||
|
);
|
||||||
1 // Highest: macOS Homebrew (M1/M2/M3/M4 Macs)
|
1 // Highest: macOS Homebrew (M1/M2/M3/M4 Macs)
|
||||||
} else if path_dir.contains("/.local/bin") {
|
} else if path_dir.contains("/.local/bin") {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Found .local path (priority 2): {}",
|
||||||
|
full_path
|
||||||
|
);
|
||||||
2 // User-local installations
|
2 // User-local installations
|
||||||
} else if path_dir.contains("/.cargo/bin") {
|
} else if path_dir.contains("/.cargo/bin") {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Found .cargo path (priority 3): {}",
|
||||||
|
full_path
|
||||||
|
);
|
||||||
3 // Cargo installations
|
3 // Cargo installations
|
||||||
} else if path_dir.contains("/usr/local/bin") {
|
} else if path_dir.contains("/usr/local/bin") {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Found /usr/local path (priority 4): {}",
|
||||||
|
full_path
|
||||||
|
);
|
||||||
4 // Linux standard location
|
4 // Linux standard location
|
||||||
} else if path_dir.contains("/usr/bin") {
|
} else if path_dir.contains("/usr/bin") {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Found /usr/bin path (priority 5): {}",
|
||||||
|
full_path
|
||||||
|
);
|
||||||
5 // System binaries
|
5 // System binaries
|
||||||
} else {
|
} else {
|
||||||
|
eprintln!("[TENDRIL DEBUG] Skipping non-standard path: {}", path_dir);
|
||||||
continue; // Skip non-standard locations
|
continue; // Skip non-standard locations
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -310,9 +335,22 @@ fn resolve_binary_path(explicit_path: &Option<String>) -> Result<String> {
|
|||||||
|
|
||||||
// Sort by priority and return the highest priority candidate
|
// Sort by priority and return the highest priority candidate
|
||||||
candidates.sort_by_key(|(priority, _)| *priority);
|
candidates.sort_by_key(|(priority, _)| *priority);
|
||||||
if let Some((_, path)) = candidates.first() {
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] All candidates after sorting: {:?}",
|
||||||
|
candidates
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some((priority, path)) = candidates.first() {
|
||||||
|
eprintln!(
|
||||||
|
"[TENDRIL DEBUG] Selected path (priority {}): {}",
|
||||||
|
priority, path
|
||||||
|
);
|
||||||
return Ok(path.clone());
|
return Ok(path.clone());
|
||||||
|
} else {
|
||||||
|
eprintln!("[TENDRIL DEBUG] No candidates found in PATH");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
eprintln!("[TENDRIL DEBUG] PATH environment variable not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback: Try common absolute paths
|
// Fallback: Try common absolute paths
|
||||||
|
|||||||
Reference in New Issue
Block a user