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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
//! Policy for routing a Ninja subprocess's standard streams.
//!
//! [`StderrMode`] carries the child-output routing decision explicitly instead
//! of burying it in a boolean re-derived inside the process layer. The runner
//! chooses the policy at the runner boundary when it builds a request: in JSON
//! diagnostics mode ([`crate::cli::Cli`]`::json`) the child's output must not
//! pollute the machine-readable streams, so the mode maps to [`Suppress`];
//! otherwise it maps to [`Forward`]. The policy travels on
//! [`crate::runner::NinjaBuildRequest`] and [`crate::runner::NinjaToolRequest`]
//! as the `stderr_mode` field, and the process layer only consumes that field —
//! it never re-derives the policy from CLI state itself.
//!
//! [`Forward`] releases the child's stdout and stderr to the parent's
//! corresponding streams, preserving ordering for builds whose output the user
//! watches live. [`Suppress`] drains both streams to `io::sink()`, keeping JSON
//! diagnostics machine-readable: stdout carries only the versioned result
//! document and stderr only the diagnostic document, with no child output mixed
//! in.
/// Policy for routing a Ninja subprocess's standard streams.
///
/// Governs both child stdout and child stderr routing: [`StderrMode::Suppress`]
/// keeps JSON diagnostics machine-readable by draining both streams to
/// `io::sink()`, while [`StderrMode::Forward`] releases them to the parent's
/// corresponding streams.