fix: TUI spawns current_exe() instead of hardcoded 'cub' in PATH
This commit is contained in:
@@ -328,7 +328,7 @@ impl CubApp {
|
||||
self.status_message = format!("Installing {}...", package_name);
|
||||
self.spawn_action(
|
||||
ActionKind::Install,
|
||||
"cub",
|
||||
&self_exe(),
|
||||
vec!["install".into(), package_name],
|
||||
);
|
||||
}
|
||||
@@ -391,7 +391,7 @@ impl CubApp {
|
||||
format!("Running command: cub build {}", 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) {
|
||||
@@ -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 {
|
||||
CubError::Io(error)
|
||||
CubError::BuildFailed(format!("terminal error: {error}"))
|
||||
}
|
||||
|
||||
fn action_label(kind: ActionKind) -> &'static str {
|
||||
|
||||
Reference in New Issue
Block a user