Skip to content

Commit 5827aec

Browse files
Merge pull request #771 from ehuss/fix-FailureReason-macos
Fix ErrorKind handling for macOS
2 parents 5224627 + a9cf024 commit 5827aec

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/runner/test.rs

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,13 @@ pub(crate) fn failure_reason(err: &Error) -> FailureReason {
2929
| CommandError::SandboxContainerCreate(_)
3030
| CommandError::WorkspaceNotMountedCorrectly
3131
| CommandError::InvalidDockerInspectOutput(_) => FailureReason::Docker,
32-
CommandError::IO(io) => {
33-
match io.kind() {
34-
ErrorKind::OutOfMemory => FailureReason::OOM,
35-
_ => {
36-
// FIXME use ErrorKind once #![feature(io_error_more)] is stable <https://github.com/rust-lang/rust/issues/86442>
37-
#[cfg(target_os = "linux")]
38-
match io.raw_os_error() {
39-
// <https://mariadb.com/kb/en/operating-system-error-codes/#linux-error-codes>
40-
| Some(28) /* ErrorKind::StorageFull */
41-
| Some(122) /* ErrorKind::FilesystemQuotaExceeded */
42-
| Some(31) /* TooManyLinks */=> {
43-
return FailureReason::NoSpace
44-
}
45-
_ => FailureReason::Unknown
46-
}
47-
48-
#[cfg(target_os = "windows")]
49-
match io.raw_os_error() {
50-
// <https://learn.microsoft.com/en-us/windows/win32/debug/system-error-codes>
51-
| Some(39|112) /* ErrorKind::StorageFull */
52-
| Some(1295) /* ErrorKind::FilesystemQuotaExceeded */
53-
| Some(1142) /* TooManyLinks */=> {
54-
return FailureReason::NoSpace
55-
}
56-
_ => FailureReason::Unknown
57-
}
58-
}
32+
CommandError::IO(io) => match io.kind() {
33+
ErrorKind::OutOfMemory => FailureReason::OOM,
34+
ErrorKind::StorageFull | ErrorKind::QuotaExceeded | ErrorKind::TooManyLinks => {
35+
FailureReason::NoSpace
5936
}
60-
}
37+
_ => FailureReason::Unknown,
38+
},
6139
CommandError::ExecutionFailed { .. } | _ => FailureReason::Unknown,
6240
}
6341
} else {

0 commit comments

Comments
 (0)