Skip to content

Commit 58352c0

Browse files
committed
Auto merge of #114589 - ijackson:exit-code-default, r=dtolnay
impl Default for ExitCode As suggested here #106425 (comment) Needs FCP since this is an insta-stable impl. Ideally we would have `impl From<ExitCode> for ExitStatus` and implement the default `ExitStatus` using that. That is sadly not so easy because of the various strange confusions about `ExitCode` (unix: exit status) vs `ExitStatus` (unix: wait status) in the not-really-unix platforms in `library//src/sys/unix/process`. I'll try to follow that up.
2 parents 30d310c + b149d16 commit 58352c0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: library/std/src/process.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ impl From<io::Stderr> for Stdio {
15941594
pub struct ExitStatus(imp::ExitStatus);
15951595

15961596
/// The default value is one which indicates successful completion.
1597-
#[stable(feature = "process-exitcode-default", since = "1.73.0")]
1597+
#[stable(feature = "process_exitstatus_default", since = "1.73.0")]
15981598
impl Default for ExitStatus {
15991599
fn default() -> Self {
16001600
// Ideally this would be done by ExitCode::default().into() but that is complicated.
@@ -1960,6 +1960,14 @@ impl ExitCode {
19601960
}
19611961
}
19621962

1963+
/// The default value is [`ExitCode::SUCCESS`]
1964+
#[stable(feature = "process_exitcode_default", since = "CURRENT_RUSTC_VERSION")]
1965+
impl Default for ExitCode {
1966+
fn default() -> Self {
1967+
ExitCode::SUCCESS
1968+
}
1969+
}
1970+
19631971
#[stable(feature = "process_exitcode", since = "1.61.0")]
19641972
impl From<u8> for ExitCode {
19651973
/// Construct an `ExitCode` from an arbitrary u8 value.

0 commit comments

Comments
 (0)