mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00

Some checks are pending
ci / build libs (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / test release windows-x86_64 (push) Blocked by required conditions
Co-authored-by: nayeemrmn <nayeemrmn@users.noreply.github.com>
32 lines
772 B
Rust
32 lines
772 B
Rust
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
|
|
pub fn is_skippable_io_error(e: &std::io::Error) -> bool {
|
|
use std::io::ErrorKind::*;
|
|
|
|
// skip over invalid filenames on windows
|
|
const ERROR_INVALID_NAME: i32 = 123;
|
|
if cfg!(windows) && e.raw_os_error() == Some(ERROR_INVALID_NAME) {
|
|
return true;
|
|
}
|
|
|
|
match e.kind() {
|
|
InvalidInput | PermissionDenied | NotFound => {
|
|
// ok keep going
|
|
true
|
|
}
|
|
_ => {
|
|
const NOT_A_DIRECTORY: i32 = 20;
|
|
cfg!(unix) && e.raw_os_error() == Some(NOT_A_DIRECTORY)
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
#[cfg(windows)]
|
|
#[test]
|
|
fn is_skippable_io_error_win_invalid_filename() {
|
|
let error = std::io::Error::from_raw_os_error(123);
|
|
assert!(super::is_skippable_io_error(&error));
|
|
}
|
|
}
|