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(windows): hide console flash on remaining cmd / where spawns

Louis Beaumontecf1a54f0388
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
index 8dfeecdeb..1300e9270 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/commands.rs
@@ -2277,17 +2277,16 @@ pub async fn open_note_path(path: String) -> Result<(), String> {
}
#[cfg(target_os = "windows")]
{
+ use std::os::windows::process::CommandExt;
use std::process::Command;
let obsidian_uri = format!("obsidian://open?path={}", urlencoding::encode(&path));
- if Command::new("cmd")
- .args(["/C", "start", "", &obsidian_uri])
- .spawn()
- .is_ok()
- || Command::new("cmd")
- .args(["/C", "start", "", &path])
- .spawn()
- .is_ok()
- {
+ let mut a = Command::new("cmd");
+ a.args(["/C", "start", "", &obsidian_uri]);
+ a.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ let mut b = Command::new("cmd");
+ b.args(["/C", "start", "", &path]);
+ b.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ if a.spawn().is_ok() || b.spawn().is_ok() {
Ok(())
} else {
Err(format!("failed to open note path: {}", path))
diff --git a/crates/screenpipe-engine/src/cli/login.rs b/crates/screenpipe-engine/src/cli/login.rs
index 47977d647..5434a24ab 100644
--- a/crates/screenpipe-engine/src/cli/login.rs
+++ b/crates/screenpipe-engine/src/cli/login.rs
@@ -23,9 +23,11 @@ fn open_browser(url: &str) {
}
#[cfg(target_os = "windows")]
{
- let _ = std::process::Command::new("cmd")
- .args(["/C", "start", "", url])
- .spawn();
+ use std::os::windows::process::CommandExt;
+ let mut cmd = std::process::Command::new("cmd");
+ cmd.args(["/C", "start", "", url]);
+ cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ let _ = cmd.spawn();
}
#[cfg(target_os = "linux")]
{
diff --git a/crates/screenpipe-engine/src/video_utils.rs b/crates/screenpipe-engine/src/video_utils.rs
index b9ed745dd..e59f2b647 100644
--- a/crates/screenpipe-engine/src/video_utils.rs
+++ b/crates/screenpipe-engine/src/video_utils.rs
@@ -55,12 +55,18 @@ fn get_ffprobe_path(ffmpeg_path: &Path) -> PathBuf {
}
}
#[cfg(windows)]
- if let Ok(output) = std::process::Command::new("where").arg("ffprobe").output() {
- if output.status.success() {
- let path_str = String::from_utf8_lossy(&output.stdout).trim().to_string();
- if let Some(first_line) = path_str.lines().next() {
- if !first_line.is_empty() {
- return PathBuf::from(first_line);
+ {
+ use std::os::windows::process::CommandExt;
+ let mut cmd = std::process::Command::new("where");
+ cmd.arg("ffprobe");
+ cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ if let Ok(output) = cmd.output() {
+ if output.status.success() {
+ let path_str = String::from_utf8_lossy(&output.stdout).trim().to_string();
+ if let Some(first_line) = path_str.lines().next() {
+ if !first_line.is_empty() {
+ return PathBuf::from(first_line);
+ }
}
}
}