Skip to content

Commit 83726fa

Browse files
committed
Make signal exit format more consistent
1 parent 758f6c4 commit 83726fa

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/out.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,18 @@ pub fn process_finish(output_stream: &StandardStream, status: &ProcessExit) {
357357
let sigstr_ptr = unsafe { strsignal(signal as std::os::raw::c_int) };
358358

359359
if sigstr_ptr.is_null() {
360-
format!("signal {}", signal)
360+
format!(
361+
"signal {}{}",
362+
signal,
363+
if core { " - core dumped" } else { "" }
364+
)
361365
} else {
362-
// SAFETY: The string returned from `strsignal` is valid until the next call to strsignal
366+
// SAFETY: The string returned from `strsignal` is valid until our next call to strsignal
363367
// and has been verified to be non-null. The string returned by `strsignal` is null-terminated.
364368
let sigstr = unsafe { CStr::from_ptr(sigstr_ptr) };
365369
format!(
366-
"signal {signal} ({}){}",
370+
"signal {} ({}){}",
371+
signal,
367372
sigstr.to_string_lossy(),
368373
if core { " - core dumped" } else { "" }
369374
)

src/process.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,7 @@ impl From<StdioRepr> for Stdio {
355355
StdioRepr::Fd(fd) => {
356356
use std::os::unix::io::FromRawFd;
357357
unsafe {
358-
// SAFETY: Umm, not sure how to enforce this, to be honest.
359-
// I'll deal with it later
358+
// SAFETY: Not currently enforced. Replace with OwnedFd and OwnedHandle when #87074 is stable
360359
Stdio::from_raw_fd(fd)
361360
}
362361
}

0 commit comments

Comments
 (0)