Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: add functions to create commands that hide console window on Windows

Tonho7c46c08cea63
diff --git a/src-tauri/src/core/process.rs b/src-tauri/src/core/process.rs
new file mode 100644
index 00000000..c5e76f2a
--- /dev/null
+++ b/src-tauri/src/core/process.rs
@@ -0,0 +1,18 @@
+/// Creates a tokio Command that hides the console window on Windows.
+pub fn command<S: AsRef<std::ffi::OsStr>>(program: S) -> tokio::process::Command {
+ let mut cmd = tokio::process::Command::new(program);
+ #[cfg(target_os = "windows")]
+ cmd.creation_flags(0x08000000);
+ cmd
+}
+
+/// Creates a std Command that hides the console window on Windows.
+pub fn std_command<S: AsRef<std::ffi::OsStr>>(program: S) -> std::process::Command {
+ let mut cmd = std::process::Command::new(program);
+ #[cfg(target_os = "windows")]
+ {
+ use std::os::windows::process::CommandExt;
+ cmd.creation_flags(0x08000000);
+ }
+ cmd
+}