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
//! Windows handle-inheritance hygiene shared by every subprocess
//! spawn site in this crate.
/// Clear `HANDLE_FLAG_INHERIT` on this process's std handles so a
/// child spawned with `bInheritHandles=TRUE` (any piped-stdio spawn)
/// does not receive duplicated copies of them. Without this, a
/// long-lived child (a detached server, or a resident daemon spawned
/// by a child CLI) keeps the write end of whatever pipe THIS process's
/// stdout/stderr happen to be — so whoever is tailing this process
/// never sees pipe EOF and waits forever after it exits.
///
/// Idempotent and best-effort: a pseudo/closed std handle that can't
/// be updated has nothing to leak. The flag only governs inheritance —
/// our own reads and writes through these handles are unaffected, and
/// `Stdio::inherit` children still work (std re-duplicates the handle
/// inheritable at spawn time).
pub