1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2026 VKrishna04
// SPDX-License-Identifier: Apache-2.0
// Building child processes that stay invisible when this process is.
//
// On Windows a console-subsystem child of a process that has no console — the scheduled
// `devpw` pass, or anything launched from a GUI — gets a brand-new console window of its
// own, visible to whoever is logged in. A background prune that spawns `git` per
// repository would flash a black window per repository, which is exactly the behaviour
// the windowless scheduler binary exists to prevent. `CREATE_NO_WINDOW` suppresses the
// allocation; it is applied only when this process has no console, so interactive runs
// spawn children exactly as they always did.
use OsStr;
use Command;
/// A `Command` that will not flash a console window when this process has none.
///
/// Every child that can be spawned on Windows is built here. The launchd and systemd
/// calls go straight to `Command::new`, which is the same thing there: the policy
/// below is a no-op off Windows, and neither platform has a console to inherit.
///
/// What holds on every platform is the other half. Every child is waited on, and
/// nothing in this program starts a process that outlives the command that started
/// it -- there is no detached helper anywhere, which is deliberate and is checked by
/// grepping for `.spawn()`.