fix: TUI spawns current_exe() instead of hardcoded 'cub' in PATH

This commit is contained in:
2026-05-08 11:48:45 +01:00
parent cd07d32597
commit cb4f56b633
@@ -328,7 +328,7 @@ impl CubApp {
self.status_message = format!("Installing {}...", package_name); self.status_message = format!("Installing {}...", package_name);
self.spawn_action( self.spawn_action(
ActionKind::Install, ActionKind::Install,
"cub", &self_exe(),
vec!["install".into(), package_name], vec!["install".into(), package_name],
); );
} }
@@ -391,7 +391,7 @@ impl CubApp {
format!("Running command: cub build {}", display), format!("Running command: cub build {}", display),
]; ];
self.status_message = format!("Building {}...", display); self.status_message = format!("Building {}...", display);
self.spawn_action(ActionKind::Build, "cub", vec!["build".into(), display]); self.spawn_action(ActionKind::Build, &self_exe(), vec!["build".into(), display]);
} }
pub fn open_selected_info(&mut self) { pub fn open_selected_info(&mut self) {
@@ -587,8 +587,14 @@ impl CubApp {
} }
} }
fn self_exe() -> String {
std::env::current_exe()
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_else(|_| "cub".to_string())
}
fn terminal_error(error: io::Error) -> CubError { fn terminal_error(error: io::Error) -> CubError {
CubError::Io(error) CubError::BuildFailed(format!("terminal error: {error}"))
} }
fn action_label(kind: ActionKind) -> &'static str { fn action_label(kind: ActionKind) -> &'static str {