diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-02-21 08:40:32 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-20 16:40:32 -0500 |
commit | ca8bc7ece8a37bc49aa3668cb64eada3027305d5 (patch) | |
tree | 27f773656bd8c5e512e5969a5bfa7ab080085467 /ext/node/polyfills/_process/process.ts | |
parent | f90889e5ee19e0ddcd9c1dbcce98720e417dd83e (diff) |
fix(ext/node): permission prompt for missing `process.env` permissions (#22487)
Closes #18665
Closes #20213
Diffstat (limited to 'ext/node/polyfills/_process/process.ts')
-rw-r--r-- | ext/node/polyfills/_process/process.ts | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/ext/node/polyfills/_process/process.ts b/ext/node/polyfills/_process/process.ts index 4fae1bc1b..cc52e7706 100644 --- a/ext/node/polyfills/_process/process.ts +++ b/ext/node/polyfills/_process/process.ts @@ -36,17 +36,10 @@ export const nextTick = _nextTick; /** Wrapper of Deno.env.get, which doesn't throw type error when * the env name has "=" or "\0" in it. */ function denoEnvGet(name: string) { - const perm = - Deno.permissions.querySync?.({ name: "env", variable: name }).state ?? - "granted"; // for Deno Deploy - // Returns undefined if the env permission is unavailable - if (perm !== "granted") { - return undefined; - } try { return Deno.env.get(name); } catch (e) { - if (e instanceof TypeError) { + if (e instanceof TypeError || e instanceof Deno.errors.PermissionDenied) { return undefined; } throw e; |