We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36a4fcc commit a34c8d6Copy full SHA for a34c8d6
src/subprocess.rs
@@ -1,3 +1,5 @@
1
+use std::os::unix::process::ExitStatusExt as _;
2
+
3
/// An error representing a subprocess that errored
4
///
5
/// This can be used to propogate a subprocesses exit status.
@@ -9,12 +11,20 @@ pub struct ExitStatusError {
9
11
}
10
12
13
impl ExitStatusError {
14
+ #[cfg(windows)]
15
pub(crate) fn new(status: std::process::ExitStatus) -> Self {
16
Self {
17
status: status.code(),
18
19
20
21
+ #[cfg(unix)]
22
+ pub(crate) fn new(status: std::process::ExitStatus) -> Self {
23
+ Self {
24
+ status: status.code().or_else(|| status.signal()),
25
+ }
26
27
28
pub fn code(&self) -> i32 {
29
self.status.unwrap_or(1)
30
0 commit comments