summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/client/app/src/process.rs
blob: 126e5b533bc17c595f5005019283be556d2b691d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* 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
}