1#[cfg(windows)]
7const CREATE_NO_WINDOW: u32 = 0x0800_0000;
8
9pub trait HideConsoleExt {
10 fn hide_console(&mut self) -> &mut Self;
11}
12
13impl HideConsoleExt for std::process::Command {
14 fn hide_console(&mut self) -> &mut Self {
15 #[cfg(windows)]
16 {
17 use std::os::windows::process::CommandExt;
18 self.creation_flags(CREATE_NO_WINDOW);
19 }
20 self
21 }
22}
23
24impl HideConsoleExt for tokio::process::Command {
25 fn hide_console(&mut self) -> &mut Self {
26 #[cfg(windows)]
27 {
28 self.creation_flags(CREATE_NO_WINDOW);
29 }
30 self
31 }
32}