From 687ff2ab14d6a735aa5bf0ec57ef00cfe0c04e4b Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 25 Feb 2021 18:16:18 +0800 Subject: fix(runtime): do not panic on irregular dir entries (#9579) --- cli/tests/unit/read_dir_test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'cli/tests/unit/read_dir_test.ts') diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts index 4a0719a4b..829f7bfa2 100644 --- a/cli/tests/unit/read_dir_test.ts +++ b/cli/tests/unit/read_dir_test.ts @@ -78,3 +78,23 @@ unitTest({ perms: { read: false } }, async function readDirPerm(): Promise< await Deno.readDir("tests/")[Symbol.asyncIterator]().next(); }, Deno.errors.PermissionDenied); }); + +unitTest( + { perms: { read: true }, ignore: Deno.build.os == "windows" }, + async function readDirDevFd(): Promise< + void + > { + for await (const _ of Deno.readDir("/dev/fd")) { + // We don't actually care whats in here; just that we don't panic on non regular entries + } + }, +); + +unitTest( + { perms: { read: true }, ignore: Deno.build.os == "windows" }, + function readDirDevFdSync(): void { + for (const _ of Deno.readDirSync("/dev/fd")) { + // We don't actually care whats in here; just that we don't panic on non regular file entries + } + }, +); -- cgit v1.2.3