Skip to content

Commit

Permalink
fix: not giving an error when pip install fails
Browse files Browse the repository at this point in the history
  • Loading branch information
BrewingWeasel committed Aug 24, 2024
1 parent 696d553 commit 3ca5ad9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ enum KalbaError {
IncorrectWrite(String, usize),
#[error("Unable to find a version of python installed on the system. It may not be installed or in the PATH.")]
PythonNotFound,
#[error("Pip install failed. Maybe you ran out of space?")]
PipInstallFailed,
#[error("Python version ({0}) does not match. Version 3.8 or later is required for stanza")]
WrongPythonVersion(String),
}
Expand Down
6 changes: 5 additions & 1 deletion src-tauri/src/setup_stanza.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub async fn setup_stanza(state: State<'_, KalbaState>, window: Window) -> Resul
message: Some("Downloading stanza (this may take a while)"),
},
)?;
new_command(
let exit_status = new_command(
data_dir
.join(".venv")
.join(if cfg!(target_os = "windows") {
Expand All @@ -131,6 +131,10 @@ pub async fn setup_stanza(state: State<'_, KalbaState>, window: Window) -> Resul
.spawn()?
.wait()?;

if !exit_status.success() {
return Err(KalbaError::PipInstallFailed);
}

state.to_save.installing_stanza = false;
Ok(())
}
Expand Down

0 comments on commit 3ca5ad9

Please sign in to comment.