From 221221cc9758225a85ecebb2de206591abf16e68 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 6 May 2020 15:51:33 -0400 Subject: BREAKING: execPath should require allow-read (#5109) --- cli/js/lib.deno.ns.d.ts | 2 +- cli/js/tests/os_test.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'cli/js') diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index a05ff9fd6..83dc362ea 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -147,7 +147,7 @@ declare namespace Deno { * * console.log(Deno.execPath()); // e.g. "/home/alice/.local/bin/deno" * - * Requires `allow-env` permission. + * Requires `allow-read` permission. */ export function execPath(): string; diff --git a/cli/js/tests/os_test.ts b/cli/js/tests/os_test.ts index a44b69e7d..e99002534 100644 --- a/cli/js/tests/os_test.ts +++ b/cli/js/tests/os_test.ts @@ -48,7 +48,10 @@ unitTest(function envPermissionDenied2(): void { // case-insensitive. Case normalization needs be done using the collation // that Windows uses, rather than naively using String.toLowerCase(). unitTest( - { ignore: Deno.build.os !== "windows", perms: { env: true, run: true } }, + { + ignore: Deno.build.os !== "windows", + perms: { read: true, env: true, run: true }, + }, async function envCaseInsensitive() { // Utility function that runs a Deno subprocess with the environment // specified in `inputEnv`. The subprocess reads the environment variables @@ -269,11 +272,11 @@ unitTest(function getDirWithoutPermission(): void { ); }); -unitTest({ perms: { env: true } }, function execPath(): void { +unitTest({ perms: { read: true } }, function execPath(): void { assertNotEquals(Deno.execPath(), ""); }); -unitTest({ perms: { env: false } }, function execPathPerm(): void { +unitTest({ perms: { read: false } }, function execPathPerm(): void { let caughtError = false; try { Deno.execPath(); -- cgit v1.2.3