Input validation fix, along with changing expect so it won't crash

This commit is contained in:
Ember
2026-02-10 17:09:55 -08:00
committed by Brad Warren
parent 5efa12f358
commit 87c79bddf7
2 changed files with 5 additions and 5 deletions

View File

@@ -21,4 +21,5 @@ tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
anyhow = "1.0.100"
shlex = "1"
installer = { path = "../../installer" }

View File

@@ -1,14 +1,13 @@
use anyhow::Context;
use tauri::Emitter;
async fn run_installer(app_handle: tauri::AppHandle, args: String) -> anyhow::Result<()> {
let args_vec = shlex::split(&args).context("Failed to parse arguments: unclosed quote")?;
tauri::async_runtime::spawn_blocking(move || {
installer::run_with_callback(
// TODO: we should split using something similar to shlex in python
args.split_whitespace(),
args_vec.iter().map(|s| s.as_str()),
Some(Box::new(move |output| {
app_handle
.emit("installer-output", output)
.expect("Error sending Rayhunter CLI installer output to GUI frontend");
let _ = app_handle.emit("installer-output", output);
})),
)
})