Source code
Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
//! Process utility functions.
use crate::std::{ffi::OsStr, process::Command};
/// Return a command configured to run in the background.
///
/// This means that no associated console will be opened, when applicable.
pub fn background_command<S: AsRef<OsStr>>(program: S) -> Command {
#[allow(unused_mut)]
let mut cmd = Command::new(program);
#[cfg(windows)]
{
#[cfg_attr(mock, allow(unused))]
use std::os::windows::process::CommandExt;
use windows_sys::Win32::System::Threading::CREATE_NO_WINDOW;
cmd.creation_flags(CREATE_NO_WINDOW);
}
cmd
}