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
// SPDX-FileCopyrightText: 2026 conpty-oxide contributors <https://github.com/P4suta/conpty-oxide/graphs/contributors>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Child process exit status.
//!
//! Windows exit codes are plain `DWORD`s: there are no signals and no
//! "terminated by" case, so [`ExitStatus`] is a thin, always-valid wrapper
//! around a `u32` rather than the platform-abstracting enum a cross-platform
//! API would need. The type lives outside the front-end modules because the
//! blocking and async APIs both hand it back from `wait`.
use fmt;
/// The exit status of a child process that has terminated.
///
/// Obtained from either front end's `Child::wait` or `Child::try_wait`. The
/// wrapped value is exactly what `GetExitCodeProcess` reported, read only
/// after the process handle was confirmed signaled — so it can never be the
/// `STILL_ACTIVE` sentinel of a still-running process.
///
/// # Examples
///
/// ```
/// use conpty_oxide::ExitStatus;
///
/// # fn check(status: ExitStatus) {
/// if status.success() {
/// println!("clean exit");
/// } else {
/// println!("failed with {}", status.code());
/// }
/// # }
/// ```
;
/// Formats as `exit code: <code>`, matching `std::process::ExitStatus` on
/// Windows: decimal for ordinary codes, hexadecimal when the high bit is set.
///
/// The hexadecimal case matters more here than it would elsewhere, because
/// the code this crate documents most — `STATUS_CONTROL_C_EXIT`, reported by
/// a child whose terminal went away — is in that range: it renders as
/// `exit code: 0xc000013a`, the spelling `NTSTATUS` values are written in
/// everywhere, rather than the unrecognizable `3221225786`.