Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix: handle missing setx in OLLAMA_ORIGINS setup without panicking (#2896)

Louis Beaumont544c8127ca59
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/main.rs b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
index 32d7dfab5..7ccea1514 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/main.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/main.rs
@@ -517,19 +517,24 @@ async fn main() {
const CREATE_NO_WINDOW: u32 = 0x08000000;
if env::var("OLLAMA_ORIGINS").is_err() {
- let output = std::process::Command::new("setx")
+ match std::process::Command::new("setx")
.args(&["OLLAMA_ORIGINS", "*"])
.creation_flags(CREATE_NO_WINDOW)
.output()
- .expect("failed to execute process");
-
- if !output.status.success() {
- error!(
- "failed to set OLLAMA_ORIGINS: {}",
- String::from_utf8_lossy(&output.stderr)
- );
- } else {
- info!("permanently set OLLAMA_ORIGINS=* for user");
+ {
+ Ok(output) => {
+ if !output.status.success() {
+ error!(
+ "failed to set OLLAMA_ORIGINS: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ } else {
+ info!("permanently set OLLAMA_ORIGINS=* for user");
+ }
+ }
+ Err(e) => {
+ warn!("setx not available, skipping OLLAMA_ORIGINS setup: {}", e);
+ }
}
}
}