23 lines
807 B
Rust
23 lines
807 B
Rust
/* 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
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
//! 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
|
|
}
|