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 fix #926 to auto destruct windows cli

Louis Beaumont069147c82c29
diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml
index 95c9e49ce..09e2bc26e 100644
--- a/.github/workflows/release-app.yml
+++ b/.github/workflows/release-app.yml
@@ -473,8 +473,8 @@ jobs:
env:
CN_API_KEY: ${{ secrets.CN_API_KEY }}
USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"
- MAX_RETRIES: 3
- RETRY_DELAY: 10
+ MAX_RETRIES: 5
+ RETRY_DELAY: 30
run: |
# create temp directory for cli
$cliDir = Join-Path $Env:GITHUB_WORKSPACE "cn-cli-temp"
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index a3d20b71d..20249700d 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.22.4"
+version = "0.22.5"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/auto_destruct.rs b/screenpipe-server/src/auto_destruct.rs
index 371638f5b..e71cfed6d 100644
--- a/screenpipe-server/src/auto_destruct.rs
+++ b/screenpipe-server/src/auto_destruct.rs
@@ -2,20 +2,49 @@ use std::process::Command;
use std::time::Duration;
use tokio::time::sleep;
+#[cfg(target_os = "windows")]
+use windows::Win32::Foundation::{CloseHandle, HANDLE};
+#[cfg(target_os = "windows")]
+use windows::Win32::System::Threading::{OpenProcess, PROCESS_QUERY_INFORMATION};
+
+#[cfg(target_os = "windows")]
+fn is_process_alive(pid: u32) -> bool {
+ unsafe {
+ let process: HANDLE = OpenProcess(PROCESS_QUERY_INFORMATION, false, pid);
+ if process.is_invalid() {
+ return false;
+ }
+ CloseHandle(process);
+ true
+ }
+}
+
pub async fn watch_pid(pid: u32) -> bool {
println!("starting to watch for app termination (pid: {})", pid);
-
+
loop {
#[cfg(target_os = "windows")]
{
- // Check both PID and process name
+ // Try Windows API first
+ if !is_process_alive(pid) {
+ println!("process {} not found via windows api", pid);
+ return true;
+ }
+
+ // Fallback to Command approach
let pid_output = Command::new("tasklist")
.args(&["/FI", &format!("PID eq {}", pid), "/NH", "/FO", "CSV"])
.output()
.expect("failed to check pid");
let app_output = Command::new("tasklist")
- .args(&["/FI", "IMAGENAME eq screenpipe-app.exe", "/NH", "/FO", "CSV"])
+ .args(&[
+ "/FI",
+ "IMAGENAME eq screenpipe-app.exe",
+ "/NH",
+ "/FO",
+ "CSV",
+ ])
.output()
.expect("failed to check app name");
@@ -35,7 +64,7 @@ pub async fn watch_pid(pid: u32) -> bool {
.args(&["-p", &pid.to_string()])
.output()
.expect("failed to execute process check command");
-
+
if !output.status.success() || output.stdout.is_empty() {
return true;
}