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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Windows job objects: the platform's stand-in for a killable process group.
//!
//! Unix addresses a subprocess tree by process group id and tears the whole thing down with one
//! `kill(-pgid)`. Windows has no equivalent signal, and `TerminateProcess` -- what `Child::kill`
//! calls -- ends exactly one process. A `cmd /C` wrapper therefore dies while everything it
//! started keeps running, keeps alef's stdout and stderr pipes open, and stalls the bounded drain
//! in [`super::capture`] for its full grace period rather than ending at the deadline. A job
//! object is the closest analogue Windows offers: every process created by a job member joins the
//! job, so `TerminateJobObject` reaches the whole tree at once. ~keep
use AsRawHandle as _;
use ;
use ;
/// An anonymous job object holding one child and everything that child goes on to create.
///
/// The handle is held for as long as the tree may still need killing; nothing else keeps the job
/// alive, and a closed handle on a job with no limits set simply detaches, leaving its members
/// running. That is deliberate: the tree is torn down when a deadline expires, never merely
/// because alef stopped watching it -- matching the Unix side, which also only signals the group
/// on expiry. ~keep
pub ;
// SAFETY: a job object handle is a kernel handle with no thread affinity; every call below is
// safe to make from any thread, and `JobObject` owns the handle exclusively.
unsafe
// SAFETY: as above -- the handle is only read, never mutated, through `&self`.
unsafe