fresh/services/
process_hidden.rs1#[cfg(windows)]
9const CREATE_NO_WINDOW: u32 = 0x0800_0000;
10
11pub trait HideWindow {
12 fn hide_window(&mut self) -> &mut Self;
15}
16
17impl HideWindow for std::process::Command {
18 #[cfg(windows)]
19 fn hide_window(&mut self) -> &mut Self {
20 use std::os::windows::process::CommandExt;
21 self.creation_flags(CREATE_NO_WINDOW)
22 }
23 #[cfg(not(windows))]
24 fn hide_window(&mut self) -> &mut Self {
25 self
26 }
27}
28
29impl HideWindow for tokio::process::Command {
30 #[cfg(windows)]
31 fn hide_window(&mut self) -> &mut Self {
32 self.creation_flags(CREATE_NO_WINDOW)
33 }
34 #[cfg(not(windows))]
35 fn hide_window(&mut self) -> &mut Self {
36 self
37 }
38}