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
// Shared by several test binaries, each of which uses a different part of it.
use OsStr;
use Command;
/// A [`Command`] whose stdio redirection survives static linking.
///
/// A statically linked artifact resolves `posix_spawn` and the whole
/// `posix_spawn_file_actions_*` family against `libchdb.a`, which carries
/// ClickHouse's glibc-compatibility shims. That `posix_spawn` deliberately does
/// not walk file actions — its own source says "callers that need file actions
/// must avoid this stub or fall back to fork+exec" — so the standard library
/// records a dup2 action, calls it, gets no error back, and the child quietly
/// inherits this process's stdout. Measured against the published archive on
/// linux/aarch64: captured output came back empty while the child's answer
/// appeared on the parent's stdout.
///
/// An empty `pre_exec` closure is what makes the standard library skip the
/// `posix_spawn` fast path, which is the fallback that source recommends. The
/// fork/exec path calls `dup2` directly, and that symbol the archive does not
/// define.