summaryrefslogtreecommitdiffstats
path: root/toolkit/crashreporter/client/app/src/process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/crashreporter/client/app/src/process.rs')
-rw-r--r--toolkit/crashreporter/client/app/src/process.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/toolkit/crashreporter/client/app/src/process.rs b/toolkit/crashreporter/client/app/src/process.rs
new file mode 100644
index 0000000000..126e5b533b
--- /dev/null
+++ b/toolkit/crashreporter/client/app/src/process.rs
@@ -0,0 +1,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
+}