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

release-app try to fix windows auto destruct

Louis Beaumont658f678ade07
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 883b1d9c6..e0da1af28 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.14.33"
+version = "0.14.34"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/auto_destruct.rs b/screenpipe-server/src/auto_destruct.rs
index dc1bcb117..371638f5b 100644
--- a/screenpipe-server/src/auto_destruct.rs
+++ b/screenpipe-server/src/auto_destruct.rs
@@ -3,23 +3,42 @@ use std::time::Duration;
use tokio::time::sleep;
pub async fn watch_pid(pid: u32) -> bool {
+ println!("starting to watch for app termination (pid: {})", pid);
+
loop {
- let (command, args) = if cfg!(target_os = "windows") {
- (
- "tasklist",
- vec!["/FI".to_string(), format!("PID eq {}", pid)],
- )
- } else {
- ("ps", vec!["-p".to_string(), pid.to_string()])
- };
+ #[cfg(target_os = "windows")]
+ {
+ // Check both PID and process name
+ let pid_output = Command::new("tasklist")
+ .args(&["/FI", &format!("PID eq {}", pid), "/NH", "/FO", "CSV"])
+ .output()
+ .expect("failed to check pid");
- let output = Command::new(command)
- .args(&args)
- .output()
- .expect("failed to execute process check command");
+ let app_output = Command::new("tasklist")
+ .args(&["/FI", "IMAGENAME eq screenpipe-app.exe", "/NH", "/FO", "CSV"])
+ .output()
+ .expect("failed to check app name");
- if !output.status.success() || output.stdout.is_empty() {
- return true;
+ let pid_alive = String::from_utf8_lossy(&pid_output.stdout).contains(&pid.to_string());
+ let app_alive = !String::from_utf8_lossy(&app_output.stdout).is_empty();
+
+ println!("pid alive: {}, app alive: {}", pid_alive, app_alive);
+
+ if !pid_alive || !app_alive {
+ return true;
+ }
+ }
+
+ #[cfg(not(target_os = "windows"))]
+ {
+ let output = Command::new("ps")
+ .args(&["-p", &pid.to_string()])
+ .output()
+ .expect("failed to execute process check command");
+
+ if !output.status.success() || output.stdout.is_empty() {
+ return true;
+ }
}
sleep(Duration::from_secs(1)).await;