Skip to content

Commit bc75d84

Browse files
authored
fix: hide the console window in Windows
ref: tauri-apps/tauri#6438
1 parent f36f37a commit bc75d84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/windows.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ use std::{
55

66
use std::os::windows::process::CommandExt;
77

8+
const CREATE_NO_WINDOW: u32 = 0x08000000;
9+
810
pub fn commands<T: AsRef<OsStr>>(path: T) -> Vec<Command> {
911
let mut cmd = Command::new("cmd");
1012
cmd.arg("/c")
1113
.arg("start")
1214
.raw_arg("\"\"")
13-
.raw_arg(wrap_in_quotes(path));
15+
.raw_arg(wrap_in_quotes(path))
16+
.creation_flags(CREATE_NO_WINDOW);
1417
vec![cmd]
1518
}
1619

1720
pub fn with_command<T: AsRef<OsStr>>(path: T, app: impl Into<String>) -> Command {
1821
let mut cmd = Command::new("cmd");
1922
cmd.arg("/c")
2023
.raw_arg(app.into())
21-
.raw_arg(wrap_in_quotes(path));
24+
.raw_arg(wrap_in_quotes(path))
25+
.creation_flags(CREATE_NO_WINDOW);
2226
cmd
2327
}
2428

0 commit comments

Comments
 (0)