From a9cf0247f726a88013553664fe32fd5a2230ed46 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 6 May 2025 11:52:02 -0700 Subject: [PATCH] Fix ErrorKind handling for macOS This code prevented things from compiling on macOS. I believe these variants were all stabilized in 1.83 (https://github.com/rust-lang/rust/pull/128316). --- src/runner/test.rs | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/runner/test.rs b/src/runner/test.rs index 13d7aa9c..15e13a32 100644 --- a/src/runner/test.rs +++ b/src/runner/test.rs @@ -29,35 +29,13 @@ fn failure_reason(err: &Error) -> FailureReason { | CommandError::SandboxContainerCreate(_) | CommandError::WorkspaceNotMountedCorrectly | CommandError::InvalidDockerInspectOutput(_) => FailureReason::Docker, - CommandError::IO(io) => { - match io.kind() { - ErrorKind::OutOfMemory => FailureReason::OOM, - _ => { - // FIXME use ErrorKind once #![feature(io_error_more)] is stable - #[cfg(target_os = "linux")] - match io.raw_os_error() { - // - | Some(28) /* ErrorKind::StorageFull */ - | Some(122) /* ErrorKind::FilesystemQuotaExceeded */ - | Some(31) /* TooManyLinks */=> { - return FailureReason::NoSpace - } - _ => FailureReason::Unknown - } - - #[cfg(target_os = "windows")] - match io.raw_os_error() { - // - | Some(39|112) /* ErrorKind::StorageFull */ - | Some(1295) /* ErrorKind::FilesystemQuotaExceeded */ - | Some(1142) /* TooManyLinks */=> { - return FailureReason::NoSpace - } - _ => FailureReason::Unknown - } - } + CommandError::IO(io) => match io.kind() { + ErrorKind::OutOfMemory => FailureReason::OOM, + ErrorKind::StorageFull | ErrorKind::QuotaExceeded | ErrorKind::TooManyLinks => { + FailureReason::NoSpace } - } + _ => FailureReason::Unknown, + }, CommandError::ExecutionFailed { .. } | _ => FailureReason::Unknown, } } else {