use std::ffi::OsStr; #[cfg(target_os = "windows")] const CREATE_NO_WINDOW: u32 = 0x0800_0000; /// Creates a new `tokio::process::Command` that won't spawn a console window on Windows. pub fn new_xplatform_command>(program: S) -> tokio::process::Command { #[allow(unused_mut)] let mut cmd = tokio::process::Command::new(program); #[cfg(target_os = "windows")] { use std::os::windows::process::CommandExt; cmd.creation_flags(CREATE_NO_WINDOW); } cmd }